To install pip on Windows, the simplest method is to use the official installer script after ensuring Python is installed. Alternatively, you can use the ensurepip module that comes bundled with Python, or download get-pip.py and run it. This article covers all three methods, how to verify the installation, and how to fix common issues.
What is pip and Why Do You Need It?
pip is the standard package installer for Python. It allows you to install, upgrade, and remove third-party libraries and tools from the Python Package Index (PyPI). Almost every Python project relies on pip to manage dependencies, so having it working correctly is essential for development. While newer Python versions (3.4 and above) include pip by default, it can sometimes be missing or broken, especially on older installations or after a manual Python setup.
Prerequisites: Check Your Python Installation
Before installing pip, you need Python installed on your system. pip is not a standalone program; it runs within a Python environment. Here’s how to check if Python is ready:
- Open a command prompt (cmd) or PowerShell.
- Type
python --versionand press Enter. If you see something likePython 3.12.1, Python is installed. - If you get an error like
'python' is not recognized, you need to install Python first. Download the latest installer from the official Python website (python.org) and during installation, check the box that says “Add Python to PATH”.
If you have multiple Python versions installed, make sure you are using the correct one. You can check with py --version to see the Python launcher’s default.
Method 1: Install pip Using ensurepip (Recommended)
Python 3.4 and later include the ensurepip module, which can install pip automatically. This is the most reliable method because it uses the exact pip version that matches your Python installation.
- Open a command prompt or PowerShell.
- Run the command:
python -m ensurepip --upgrade - Wait for the process to finish. It will display a message like
Successfully installed pip-24.0. - Verify the installation by running
pip --version.
If you get an error saying No module named ensurepip, it means your Python installation is incomplete or too old. In that case, use Method 2.
Method 2: Install pip Using get-pip.py
The official pip documentation recommends using the get-pip.py script. This method works for any Python version and also installs additional tools like wheel and setuptools.
- Download the script from the official source: https://bootstrap.pypa.io/get-pip.py. Save it to a folder you can easily access, e.g.,
C:\Users\YourName\Downloads. - Open a command prompt and navigate to that folder using
cd. For example:cd C:\Users\YourName\Downloads. - Run the script with Python:
python get-pip.py - The script will install pip and its dependencies. You should see a success message.
- Verify with
pip --version.
If you have multiple Python versions, you can specify which one to use: py -3.12 get-pip.py.
Method 3: Install pip via the Python Installer
If you are reinstalling Python from scratch, the official installer can include pip. During the installation, ensure the option “pip” is checked under the features list. If you already have Python installed but didn’t select this, you can modify the installation:
- Open the Control Panel and go to Programs and Features (or Apps & Features in newer Windows).
- Find Python in the list, select it, and click Change.
- In the installer window, choose Modify.
- Make sure pip is checked under Optional Features, then click Next and Install.
This method is useful if you want to repair an existing installation without downloading anything else.
How to Verify pip is Installed Correctly
After installation, you should confirm that pip works and is accessible from the command line. Here’s what to do:
- Open a new command prompt or PowerShell (important: close and reopen to refresh the PATH).
- Type
pip --version. You should see output likepip 24.0 from C:\Users\YourName\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip (python 3.12). - Try a simple command:
pip listto see installed packages. It should show a table of packages (likely only pip and setuptools). - If you get
'pip' is not recognized, it means the Scripts folder is not in your PATH. See the troubleshooting section below.
Common Problems and How to Fix Them
Problem: ‘pip’ is not recognized as an internal or external command
This is the most common issue. It means Windows cannot find the pip executable. The fix is to add the Scripts folder to your system PATH. The Scripts folder is usually located in the same directory as your Python installation, e.g., C:\Users\YourName\AppData\Local\Programs\Python\Python312\Scripts.
- Find the exact path. You can use the command
where pythonto locate Python, then look for theScriptsfolder next to it. - Open System Properties (Win + Pause/Break, then Advanced system settings).
- Click Environment Variables.
- Under System variables, select Path and click Edit.
- Add the full path to the Scripts folder (e.g.,
C:\Users\YourName\AppData\Local\Programs\Python\Python312\Scripts). - Click OK on all windows and restart your command prompt.
Alternatively, you can use python -m pip instead of pip to avoid PATH issues temporarily.
Problem: pip installs to the wrong Python version
If you have multiple Python versions, pip might be tied to one specific version. To ensure you’re using the correct pip, use the module syntax: python -m pip install package_name. This guarantees that the package is installed for the Python interpreter you are invoking.
Problem: Permission errors when installing packages
If you see PermissionError or Access is denied, it means pip is trying to write to a system directory without admin rights. Solutions:
- Run the command prompt as Administrator (right-click and select “Run as administrator”).
- Or, install packages only for the current user using
pip install --user package_name.
How to Upgrade pip
It’s a good practice to keep pip up to date. Use the following command to upgrade pip itself:
python -m pip install --upgrade pip
This will download the latest version from PyPI and replace the old one. You can check the current version with pip --version.
Frequently Asked Questions
Do I need to install pip separately if I have Python 3.4+?
No, Python 3.4 and later include pip by default. However, it might be outdated or accidentally removed. If pip --version fails, use the ensurepip or get-pip.py method to reinstall it.
What is the difference between pip and pip3?
On Windows, they are usually the same. pip is the generic command, while pip3 is used on some systems to explicitly target Python 3. On Windows, both typically point to the same executable unless you have a very unusual setup.
Can I use pip without adding it to PATH?
Yes, you can run python -m pip instead of pip. This works as long as Python itself is in PATH, which is usually the case. It’s a good habit to use this form to avoid confusion with multiple Python versions.
Why do I get a “No module named pip” error when using ensurepip?
This error means your Python installation is missing the ensurepip module, which can happen with very old Python versions (before 3.4) or with some custom builds. In that case, download and run get-pip.py as described above.
How do I uninstall pip?
You can uninstall pip using pip itself: pip uninstall pip. Be careful, as this will remove pip entirely and you’ll need to reinstall it using the methods above if you change your mind.
Is it safe to use pip to install packages?
Yes, pip is the official package manager for Python and is widely used. However, you should only install packages from trusted sources. Always check the package’s reputation and read the description before installing. Avoid installing packages that request excessive permissions or are poorly maintained.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Fix Outlook Sent Items Missing? Quick Solutions
- Fix Missing Scroll Bar in Chrome
- Fix Sony Vegas Crashing on Windows 10
- Hide WhatsApp Channel: Android & iOS Guide
- Slow Context Menu in Windows 11: Fixes
- Declutter Safari on iPhone: 15 Quick Tips