How to Install Pip on Windows
Pip is the standard package manager for Python. It enables the installation and management of third party packages that provide features and functionality not contained in the Python standard library. Newer versions of Python (Python 2 >= v2.7.9 or Python 3 >= v3.4) come prepackaged with pip by default. Pip is also included in the virtual environments created by virtualenv and pyvenv.
But if you’re using an older version of Python, pip will need to be manually installed. This tutorial steps through how to install Pip on Windows, and explains how to keep it updated.
Prerequisites for Pip Installation
- Check if pip is already installed by running the following on the command line:
If pip is installed, you’ll see something similar to the following output:
C:usersjdoe>pip --version Pip 19.2.3 from c:usersjdoeappdatalocalprogramspythonpython38-32libsite-packagespip (python 3.8)
- Verify that Python is installed. If pip is not installed, you can confirm that Python is available on your local machine and determine the version by running the following command:
You should see something like the following if Python is installed:
C:usersjdoe>pip --version Python 3.8.0
If you do not have a version of Python installed, you can quickly download and install a recent version of ActivePython.
How to Install Pip with get-pip.py
- To manually install pip on Windows, you will need a copy of get-pip.py. For older Python versions, you may need to use the appropriate version of the file from pypa.org. Download the file to a folder on your computer, or use the curl command:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
- Next, run the following command to install pip:
If the file is not found, you may need to first navigate to the directory containing the get-pip.py file. On installation, you should see something similar to the following:
Installing collected packages: pip, setuptools, wheel The script wheel.exe is installed in ‘C:Python33Scripts’ which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed pip-10.0.1 setuptools-39.2.0 wheel-0.29.0
This command will also install setuptools and wheel if they are not already installed. Setuptools is a suite of configuration enhancements to the Python distutils that facilitates building Python distributions. It is required to install source distributions, or “sdists,” a distribution format that provides the metadata and source files needed for tools like pip.
- Verify that pip is installed by running the previous command to check the version. Navigate to the installation location (C:Python33Scripts by default) and run:
For further instructions on how to install packages with pip, refer to our guide to Python Package Installation on Windows
Adding PIP to Windows Environment Variables
One of the most common problems with running Python tools like pip is the “not on PATH” error. This means that Python cannot find the tool you’re trying to run in your current directory. In most cases, you’ll need to navigate to the directory in which the tool is installed before you can run the command to launch it.
If you’d rather run pip (or other tools) from any location, you’ll need to add the directory in which it’s installed as a PATH environment variable by doing the following:
- Open up the Control Panel and navigate to System and Security > System
- Click on the Advanced system settings link on the left panel
- Click Environment Variables.
- Under System Variables, double-click the variable PATH.
- Click New, and add the directory where pip is installed, e.g. C:Python33Scripts, and select OK.
Upgrading Pip on Windows
Pip is a key tool in the Python ecosystem, and as such is updated on a regular basis. Changes can always be found in the release notes for each version. In order to keep your version of pip up to date, you can run the following on the command line:
python -m pip install -U pip
This command will uninstall the outdated version of pip first, and then download the most current iteration.
It’s also possible to downgrade to a previous version of pip, in case a newer version is causing unexpected compatibility errors. For example, to downgrade to pip v18.0 run the following command:
python -m pip install pip==18.0
Create a custom Python runtime for your next project. Pick just the packages you need, and we’ll automatically resolve all dependencies, build it (including C code) and package it for your platform.
Use ActivePython and accelerate your Python projects.
- The #1 Python solution used by innovative enterprise teams
- Comes pre-bundled with top Python packages
- Spend less time resolving dependencies and more time on quality coding