Chat Zalo Chat Messenger Phone Number Đăng nhập
How to Install Pip on Windows - ActiveState

How to Install Pip on Windows – ActiveState

Pip is the standard package manager for Python. It allows the installation and management of third-party packages that provide features and functionality not contained in the standard Python 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 are using an older version of Python, pip will need to be installed manually. This tutorial explains how to install Pip on Windows and explains how to keep it up to date.

Prerequisites for pip installation

Check if pip is

  1. already installed by running the following on the command line

: pip -version

or

pip -V If pip

is installed, you will see something similar to the following output

: C:usersjdoe>pip -version Pip 19.2.3 from c:usersjdoeappdatalocalprogramspythonpythonpython38-32libsite-packagespip (python 3.8)

  1. 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: python -version

You should see something like the following if Python is

installed: C:usersjdoe>pip -version Python 3.8.0 If you

don’t 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

  1. To manually install pip on Windows, you will need a copy of get-pip.py. For earlier versions of Python, you may need to use the appropriate version of the pypa.org file. Download the file to a folder on your computer or use

the curl: curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py command

  1. Then run the following command to install pip:

python get-pip.py If the file

is not found, you may first need to navigate to the directory that contains the get-pip.py file. In the installation, you should see something similar to the following

: Installing collected packages: pip, setuptools, wheel The script.exe wheel is installed in ‘C:Python33Scripts’ which is not in 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 set of configuration enhancements for Python distributions that makes it easier to create Python distributions. It requires installing source distributions, or “sdists,” a distribution format that provides the metadata and source files needed for tools like pip.

  1. Verify that pip is installed by running the above command to verify the version. Navigate to the installation location (C:Python33Scripts by default) and run:

pip -version

For more instructions on how to install packages with pip, see our guide to Installing Python Packages

on Windows

Add PIP to Windows Environment Variables

One of the most common problems when running Python tools like pip is the “not on PATH” error. This means that Python cannot find the tool you are trying to run in your current directory. In most cases, you will need to navigate to the directory where the tool is installed before you can run the command to start it.

If you prefer to run pip (or other tools) from any location, you will need to add the directory in which it is installed as a PATH environment variable by doing the following:

  1. Open Control Panel and go to System and Security >
  2. System Click the

  3. Advanced System Settings link in the left pane Click
  4. Environment Variables.
  5. Under System Variables , double-click the PATH variable.
  6. Click New and add the directory where pip is installed, for example, C:Python33Scripts, and select OK.

How to install Pip on Windows environment variables

Pip Update

on Windows

Pip is a key tool in the Python ecosystem and as such is regularly updated. Changes can always be found in the release notes for each release. To keep your pip version 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 latest iteration

.

It is also possible to downgrade to an older 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

Next steps

Try the ActiveState platform to create Python packages faster and more securely. Create a custom Python runtime for your next project. Choose only the packages you need and we’ll automatically resolve all dependencies, compile it (including C code), and package it for your platform.

Contact US