How to install pip python on windows

Edit this page

Toggle table of contents sidebar

Usually, pip is automatically installed if you are:

  • working in a
    virtual environment

  • using Python downloaded from python.org

  • using Python that has not been modified by a redistributor to remove
    ensurepip

Supported Methods#

If your Python environment does not have pip installed, there are 2 mechanisms
to install pip supported directly by pip’s maintainers:

  • ensurepip

  • get-pip.py

ensurepip#

Python comes with an ensurepip module[1], which can install pip in
a Python environment.

Linux

$ python -m ensurepip --upgrade

MacOS

$ python -m ensurepip --upgrade

Windows

C:> py -m ensurepip --upgrade

More details about how ensurepip works and how it can be used, is
available in the standard library documentation.

get-pip.py#

This is a Python script that uses some bootstrapping logic to install
pip.

  • Download the script, from https://bootstrap.pypa.io/get-pip.py.

  • Open a terminal/command prompt, cd to the folder containing the
    get-pip.py file and run:

More details about this script can be found in pypa/get-pip’s README.

Standalone zip application#

Note

The zip application is currently experimental. We test that pip runs correctly
in this form, but it is possible that there could be issues in some situations.
We will accept bug reports in such cases, but for now the zip application should
not be used in production environments.

In addition to installing pip in your environment, pip is available as a
standalone zip application.
This can be downloaded from https://bootstrap.pypa.io/pip/pip.pyz. There are
also zip applications for specific pip versions, named pip-X.Y.Z.pyz.

The zip application can be run using any supported version of Python:

If run directly:

Linux

$ python -m pip.pyz --help

MacOS

$ python -m pip.pyz --help

Windows

then the currently active Python interpreter will be used.

Alternative Methods#

Depending on how you installed Python, there might be other mechanisms
available to you for installing pip such as
using Linux package managers.

These mechanisms are provided by redistributors of pip, who may have modified
pip to change its behaviour. This has been a frequent source of user confusion,
since it causes a mismatch between documented behaviour in this documentation
and how pip works after those modifications.

If you face issues when using Python and pip installed using these mechanisms,
it is recommended to request for support from the relevant provider (eg: Linux
distro community, cloud provider support channels, etc).

Upgrading pip#

Upgrade your pip by running:

Linux

$ python -m pip install --upgrade pip

MacOS

$ python -m pip install --upgrade pip

Windows

C:> py -m pip install --upgrade pip

Compatibility#

The current version of pip works on:

  • Windows, Linux and MacOS.

  • CPython 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, and latest PyPy3.

pip is tested to work on the latest patch version of the Python interpreter,
for each of the minor versions listed above. Previous patch versions are
supported on a best effort approach.

Other operating systems and Python versions are not supported by pip’s
maintainers.

Users who are on unsupported platforms should be aware that if they hit issues, they may have to resolve them for themselves. If they received pip from a source which provides support for their platform, they should request pip support from that source.


Prerequisite: Python Language Introduction

Before we start with how to install pip for Python on Windows, let’s first go through the basic introduction to Python. Python is a widely-used general-purpose, high-level programming language. Python is a programming language that lets you work quickly and integrate systems more efficiently. 

PIP is a package management system used to install and manage software packages/libraries written in Python. These files are stored in a large “online repository” termed as Python Package Index (PyPI). pip uses PyPI as the default source for packages and their dependencies. So whenever you type:

pip install package_name

pip will look for that package on PyPI and if found, it will download and install the package on your local system.

Check if Python is installed

Run the following command to test if python is installed or not. If not click here.

python --version

If it is installed, You will see something like this:

Python 3.10.0

Download and Install pip

The PIP can be downloaded and installed using the command line by going through the following steps:

Method 1: Using cURL in Python

Curl is a UNIX command that is used to send the PUT, GET, and POST requests to a URL. This tool is utilized for downloading files, testing REST APIs, etc.

Step 1: Open the cmd terminal 

Step 2: In python, a curl is a tool for transferring data requests to and from a server. Use the following command to request:

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

Method 2: Manually install PIP on Windows

Pip must be manually installed on Windows. You might need to use the correct version of the file from pypa.io if you’re using an earlier version of Python or pip. Get the file and save it to a folder on your PC.

Step 1: Download the get-pip.py (https://bootstrap.pypa.io/get-pip.py) file and store it in the same directory as python is installed.

Step 2: Change the current path of the directory in the command line to the path of the directory where the above file exists. 

Step 3: get-pip.py is a bootstrapping script that enables users to install pip in Python environments. Run the command given below:

python get-pip.py

Step 4: Now wait through the installation process. Voila! pip is now installed on your system.

Verification of the installation process

One can easily verify if the pip has been installed correctly by performing a version check on the same. Just go to the command line and execute the following command:

pip -V
or
pip --version

Adding PIP To Windows Environment Variables

If you are facing any path error then you can follow the following steps to add the pip to your PATH. You can follow the following steps to set the Path:

  • Go to System and Security > System in the Control Panel once it has been opened.
  • On the left side, click the Advanced system settings link.
  • Then select Environment Variables.
  • Double-click the PATH variable under System Variables.
  • Click New, and add the directory where pip is installed, e.g. C:Python33Scripts, and select OK.

Upgrading Pip On Windows

pip can be upgraded using the following command.

python -m pip install -U pip

Downgrading Pip On Windows

It may happen sometimes that your pip current pip version is not supporting your current version of python or machine for that you can downgrade your pip version with the following command. 
Note: You can mention the version you want to install 

python -m pip install pip==17.0

Last Updated :
17 Apr, 2023

Like Article

Save Article

In this tutorial, we will identify PIP for Python, when we use it, how to install it, how to check its version, how to configure it on Windows, and how to upgrade (or downgrade) it.

What Is PIP for Python?

PIP stands for «PIP Installs Packages», which is a recursive acronym (the one that refers to itself) coined by its creator. In more practical terms, PIP is a widely used package-management system designed to install libraries that aren’t included in the standard distribution of the Python programming language on our local machine — and then manage them from the command line.

By default, PIP fetches such libraries from Python Package Index (PyPI), which is a central online repository containing a vast collection of third-party packages for various applications. If necessary, PIP can also connect to another local or online repository as long as it complies to PEP 503.

How to Install PIP on Windows

Before proceeding to PIP installation on Windows, we need to make sure that Python is already installed and PIP is not installed.

Check If Python Is Available

To verify that Python is available on our local machine, we need to open the command line (in Windows search, type cmd and press Enter to open Command Prompt or right-click on the Start button and select Windows PowerShell), type python, and press Enter.

If Python is properly installed, we will see a notification like the one below:

Python 3.10.2 (tags/v3.10.2:a58ebcc, Jan 17 2022, 14:12:15) [MSC v.1929 64 bit (AMD64)] on win32 Type "help," "copyright," "credits," or "license" for more information.

In the opposite case, we will see the following notification:

'python' is not recognized as an internal or external command, operable program or batch file.

This means that Python is either not installed on our local machine or is installed incorrectly and needs setting system variables. If you need further guidance on how to properly install Python on Windows, you can use this article in the Dataquest blog: Tutorial: Installing Python on Windows.

Check If PIP Is Already Installed

Now that we verified that Python is installed on Windows (or, if it was not, have installed it), let’s check if PIP is already installed on our system.

The latest releases Python 3.4+ and Python 2.7.9+, as well as the virtual environments virtualenv and pyvenv, automatically ship with PIP (we can check our Python version by running python --version or python -V in the command line). However, the older versions of Python don’t have this advantage by default. If we use an older Python release and cannot upgrade it for some reason (e.g., when we have to work with the projects made in old versions of Python incompatible with the newer versions), we may need to manually download and install PIP on Windows.

To check if PIP is already installed on Windows, we should open the command line again, type pip, and press Enter.

If PIP is installed, we will receive a long notification explaining the program usage, all the available commands and options. Otherwise, if PIP is not installed, the output will be:

'pip' is not recognized as an internal or external command, operable program or batch file.

This is exactly the case when we have to manually install PIP on Windows.

Download PIP

Before installing PIP, we have to download the get-pip.py file. We can do this two ways:

  1. Go to https://bootstrap.pypa.io/get-pip.py and save this file as get-pip.py in the same folder where Python is located.
    By default, the Python installation is stored in the folder AppData. The entire path could look like the following:

C:\Users\User\AppData\Local\Programs\Python\Python310

The folder User can be called differently on a particular machine, and also the final folder in the above path depends on the version of Python. In our case – Python 3.10:

  1. Open the command line and navigate to the folder where Python is stored using the cd command (see the previous point if you are not sure about Python’s location).

Now, run the following curl command:

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

Install PIP on Windows

Now that we downloaded the get-pip.py file, we need to complete the followings steps.

  1. Open the command line
  2. Navigate to the folder where Python and the get-pip.py file are stored using the cd command
  3. Launch the installer by running the following command:

python get-pip.py

After a quick installation process, a message appears with all the details of the installation, and the final line appears as follows:

Successfully installed pip-22.0.1 wheel-0.37.1

PIP is now successfully installed on Windows.

Verify the PIP Installation Process and Check the PIP Version

To double-check if PIP has been installed properly and check its version, we need to run one of these commands in the command line:

pip --version

or

pip -V

If PIP is installed correctly, we will see a message indicating the version of PIP and its location on the local system, like the following:

pip 22.0.2 from C:\Users\Utente\AppData\Local\Programs\Python\Python310\lib\site-packages\pip (python 3.10).

If instead, an error is thrown, it is necessary to repeat the installation process.

Add PIP to Windows Environment Variables

To be able to run PIP without issues from any folder in the command line (rather than navigating every time to the folder where the PIP installer is stored, as we did earlier), we have to add the path to the folder with the get-pip.py file to Windows environment variables. This is especially important in that rare case when, we have installed several versions of Python, including old ones. In this situation, to avoid installing PIP separately for each old version of Python, we should install it only for one of them and then perform the following steps:

  • Open Control Panel (typing it in Windows search), select System and Security, then select System.
  • Go to the end of the opened window and select Advanced system settings:

  • Click Environment Variables:

  • In the System variables section, find and double-click the variable Path:

  • Click New and add the path to the folder where the PIP installer is stored:

  • Click OK to confirm modifications.

Upgrade PIP on Windows

Sometimes, we may need to update PIP on Windows to the latest version to keep it up-to-date and working flawlessly. For this purpose, we can run the following command in the command line:

python -m pip install --upgrade pip

As a result, the old version of PIP will be uninstalled and the most recent release will be installed.

Downgrade PIP on Windows

We can also want to downgrade PIP to a specific older version. This operation may be necessary in certain cases, for example, if a new version works with some compatibility issues. To downgrade PIP on Windows, we need to open the command line and run a command with the following syntax:

python -m pip install pip==<version>

Let’s say, we want to downgrade it to v20.3. Then the exact command will be:
python -m pip install pip==20.3

After downgrading PIP, we can verify that we now have the necessary version of it by running python -V.

Conclusion

In this tutorial we covered various topics regarding the installation of PIP on Windows:

  • How PIP works
  • How to check if Python and PIP are already installed
  • When it may be necessary to manually install PIP on Windows
  • How to download and install PIP on Windows
  • How to verify if PIP has been successfully installed and check its version
  • How to configure PIP on Windows and when it may be necessary
  • When and how to upgrade or downgrade PIP on Windows

Now that we have PIP properly installed on Windows, we can begin using it to manage Python libraries. Let’s start with running pip help in the command line and exploring the available commands and options for this program.

Python 3.4+ and 2.7.9+

Good news! Python 3.4 (released March 2014) and Python 2.7.9 (released December 2014) ship with Pip. This is the best feature of any Python release. It makes the community’s wealth of libraries accessible to everyone. Newbies are no longer excluded from using community libraries by the prohibitive difficulty of setup. In shipping with a package manager, Python joins Ruby, Node.js, Haskell, Perl, Go—almost every other contemporary language with a majority open-source community. Thank you, Python.

If you do find that pip is not available, simply run ensurepip.

  • On Windows:

    py -3 -m ensurepip
    
  • Otherwise:

    python3 -m ensurepip
    

Of course, that doesn’t mean Python packaging is problem solved. The experience remains frustrating. I discuss this in the Stack Overflow question Does Python have a package/module management system?.

Python 3 ≤ 3.3 and 2 ≤ 2.7.8

Flying in the face of its ‘batteries included’ motto, Python ships without a package manager. To make matters worse, Pip was—until recently—ironically difficult to install.

Official instructions

Per https://pip.pypa.io/en/stable/installing/#do-i-need-to-install-pip:

Download get-pip.py, being careful to save it as a .py file rather than .txt. Then, run it from the command prompt:

python get-pip.py

You possibly need an administrator command prompt to do this. Follow Start a Command Prompt as an Administrator (Microsoft TechNet).

This installs the pip package, which (in Windows) contains …\Scripts\pip.exe that path must be in PATH environment variable to use pip from the command line (see the second part of ‘Alternative Instructions’ for adding it to your PATH,

Alternative instructions

The official documentation tells users to install Pip and each of its dependencies from source. That’s tedious for the experienced and prohibitively difficult for newbies.

For our sake, Christoph Gohlke prepares Windows installers (.msi) for popular Python packages. He builds installers for all Python versions, both 32 and 64 bit. You need to:

  1. Install setuptools
  2. Install pip

For me, this installed Pip at C:\Python27\Scripts\pip.exe. Find pip.exe on your computer, then add its folder (for example, C:\Python27\Scripts) to your path (Start / Edit environment variables). Now you should be able to run pip from the command line. Try installing a package:

pip install httpie

There you go (hopefully)! Solutions for common problems are given below:

Proxy problems

If you work in an office, you might be behind an HTTP proxy. If so, set the environment variables http_proxy and https_proxy. Most Python applications (and other free software) respect these. Example syntax:

http://proxy_url:port
http://username:password@proxy_url:port

If you’re really unlucky, your proxy might be a Microsoft NTLM proxy. Free software can’t cope. The only solution is to install a free software friendly proxy that forwards to the nasty proxy. http://cntlm.sourceforge.net/

Unable to find vcvarsall.bat

Python modules can be partly written in C or C++. Pip tries to compile from source. If you don’t have a C/C++ compiler installed and configured, you’ll see this cryptic error message.

Error: Unable to find vcvarsall.bat

You can fix that by installing a C++ compiler such as MinGW or Visual C++. Microsoft actually ships one specifically for use with Python. Or try Microsoft Visual C++ Compiler for Python 2.7.

Often though it’s easier to check Christoph’s site for your package.

Built to run applications from a wide assortment of third-party sources on a server, Python is easily one of the most widely used open-source programming languages out there that lets you integrate systems efficiently and get work done quickly. And PIP is the best tool for the purposes of installing and managing Python packages. Python users would concur. 

Although PIP comes pre-packaged with the newest versions of Python, if you’re using an older version, you will have to install PIP on Windows yourself. Here is everything you need to know about installing PIP on Windows 11.

What is PIP?

PIP (or Preferred installer program) is a tool that enables third-party package installations and is the standard package manager for Python. Through PIP, you can install and manage packages that contain some features that are not available in the standard Python library. As such, a wide variety of applications use PIP to install binary packages, which is one of the reasons for its widespread fame.

Related: Windows 11 Shortcuts: Our Complete List

How to check if PIP is already installed

As mentioned, PIP is so important for Python that it has been included with the Python installer since Python version 3.4 (for Python 3) and Python version 2.7.9 (for Python 2). That means it’s possible that you most probably have PIP already installed. To check if that is the case, first, open an elevated instance of the Command Prompt.

To do so, press Start, type cmd, then click on Run as administrator.

Then type the following command:

pip help

If the command prompt tells you that “‘pip’ is not recognized as an internal or external command, operable program or batch file”, it is either not installed or its system variable path hasn’t been set. If you’re sure that PIP has been installed, then go to the last section to know the fix.

If for some reason you don’t have pip installed or are using an older version, here are the steps to install pip on Windows 11.

Related: How to Create a Restore Point in Windows 11

Method #01: Install PIP while installing/upgrading Python 3

Download python from here.

Once downloaded, run the setup file. Then click on Customize installation.

Here, make sure there’s a tick next to ‘pip’ to ensure that it gets installed.

Although you wouldn’t need to do this for newer versions of Python, it is one way to be sure that it does get installed. Click on ‘Next’ and go ahead with the installation.

Method #02: Using get-pip.py file and command line

Well, here is how to fix an existing PIP installation or install a new one if you already got Pything but only want to install PIP now.

Step 1: Download the get-pip.py file

Firstly, download the get-pip.py file.

You may notice upon clicking the link that you are taken to a new page with a bunch of binary data. In that case, press ctrl+s to save the file. However, to easily download it, you will have to right-click on the link given above and select Save links as… option and then save the file on your hard disk.

Copy the file to the same directory where Python is installed. For us, it is Pythin39 but it may change for you depending on what version of Python 2 or 3 you have installed. So, the python folder for us is here: C:\Users\(username)\AppData\Local\Programs\Python\Python39.

Step 2: Install PIP via Command Prompt

Now, to install PIP, open the Command Prompt as shown before. Change the current path directory to the directory where the file is saved by typing the following command and press Enter:

cd C:\Users\shash\AppData\Local\Programs\Python\Python39

Now, type the following command and press Enter:

python get-pip.py

Wait for the installation process to complete. Once it’s done, you will see the ‘Successfully installed pip…’ message.

And that’s it! PIP is now installed on your system. 

How to check PIP version and verify PIP installation

Just to be sure, you can verify whether pip has been properly installed or not by checking its version. To do so, enter the following command in the Command Prompt and hit Enter:

pip -V

The Command Prompt will show you the PIP version in the next line.

How to upgrade PIP

PIP, just like every software, gets updated from time to time and it’s important to stay updated to get the most out of the latest features and bug fixes. In fact, you can even update PIP with a simple command line. Here’s how to do so:

Open the Command Prompt as shown before. Then type the following command line and press Enter:

python -m pip install --upgrade pip

This will uninstall the previous version and get you updated to the latest PIP version. 

How to downgrade PIP

On the other hand, if you are experiencing compatibility issues with the latest version of PIP, you may want to downgrade it to a previous version. Here’s how you can downgrade PIP:

Open the Command Prompt and enter the following command, followed by the specific PIP version number, and press Enter:

python -m pip install pip==(version number)

This will uninstall the previous version and install the PIP version that you’ve specified. 

Fix: ‘PIP’ is not recognized as an internal or external command

There may be times when, while running the PIP command, the Command Prompt gives the “not recognized as an internal or external command” error message. There can be two causes for this – either PIP is not installed on your computer, or it’s not added to the PATH environment variable. 

Since we’ve already shown how to install PIP on Windows 11, the problem most definitely lies with the Path environment variable not being updated. To fix this error message, follow the instructions given below:

Press Start and search for System Environment Variables, and click on the first option.

 

Now click on Environment Variables.

Under ‘System Variables’, double-click on Path.

Here, click on New.

Then add the location where ‘PIP’ is installed. By default this is C:\Users\(username)\AppData\Local\Programs\Python\Python39\Scripts

Click OK on all open windows.

Now open a new instance of Command Prompt and try the ‘pip’ command again. Because the command prompt now knows where to look for the ‘pip’ command, it won’t throw up the error message again.

So this is how you can install PIP on Windows 11, upgrade, or downgrade it.

RELATED

  • How to Change a Wallpaper on Windows 11
  • How to Ungroup Icons on Windows 11 Taskbar With a Registry Hack
  • What Windows 11 Services to Disable Safely and How?
  • How to Show Hidden Files on Windows 11
  • How to Change Brightness on Windows 11
  • How to Find Product Key on Windows 11

  • How to install windows from ubuntu
  • How to install php on windows
  • How to install windows from linux
  • How to install openssl on windows
  • How to install nvm on windows