How to run pip on windows

View 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

$ chmod +x ./pip.pyz
$ ./pip.pyz

then the currently active Python interpreter will be used.

MacOS

$ chmod +x ./pip.pyz
$ ./pip.pyz

then the currently active Python interpreter will be used.

Windows

then the currently active Python interpreter will be used.

You may need to configure your system to recognise the .pyz extension
before this will work.

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.9, 3.10, 3.11, 3.12, 3.13, 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.


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.

This section covers the basics of how to install Python packages.

It’s important to note that the term “package” in this context is being used to
describe a bundle of software to be installed (i.e. as a synonym for a
distribution). It does not refer to the kind
of package that you import in your Python source code
(i.e. a container of modules). It is common in the Python community to refer to
a distribution using the term “package”. Using
the term “distribution” is often not preferred, because it can easily be
confused with a Linux distribution, or another larger software distribution
like Python itself.

Requirements for Installing Packages¶

This section describes the steps to follow before installing other Python
packages.

Ensure you can run Python from the command line¶

Before you go any further, make sure you have Python and that the expected
version is available from your command line. You can check this by running:

You should get some output like Python 3.6.3. If you do not have Python,
please install the latest 3.x version from python.org or refer to the
Installing Python section of the Hitchhiker’s Guide to Python.

Note

If you’re a newcomer and you get an error like this:

>>> python3 --version
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'python3' is not defined

It’s because this command and other suggested commands in this tutorial
are intended to be run in a shell (also called a terminal or
console). See the Python for Beginners getting started tutorial for
an introduction to using your operating system’s shell and interacting with
Python.

Note

If you’re using an enhanced shell like IPython or the Jupyter
notebook, you can run system commands like those in this tutorial by
prefacing them with a ! character:

In [1]: import sys
        !{sys.executable} --version
Python 3.6.3

It’s recommended to write {sys.executable} rather than plain python in
order to ensure that commands are run in the Python installation matching
the currently running notebook (which may not be the same Python
installation that the python command refers to).

Note

Due to the way most Linux distributions are handling the Python 3
migration, Linux users using the system Python without creating a virtual
environment first should replace the python command in this tutorial
with python3 and the python -m pip command with python3 -m pip --user. Do not
run any of the commands in this tutorial with sudo: if you get a
permissions error, come back to the section on creating virtual environments,
set one up, and then continue with the tutorial as written.

Ensure you can run pip from the command line¶

Additionally, you’ll need to make sure you have pip available. You can
check this by running:

If you installed Python from source, with an installer from python.org, or
via Homebrew you should already have pip. If you’re on Linux and installed
using your OS package manager, you may have to install pip separately, see
Installing pip/setuptools/wheel with Linux Package Managers.

If pip isn’t already installed, then first try to bootstrap it from the
standard library:

Unix/macOS

python3 -m ensurepip --default-pip

Windows

py -m ensurepip --default-pip

If that still doesn’t allow you to run python -m pip:

  • Securely Download get-pip.py [1]

  • Run python get-pip.py. [2] This will install or upgrade pip.
    Additionally, it will install Setuptools and wheel if they’re
    not installed already.

    Warning

    Be cautious if you’re using a Python install that’s managed by your
    operating system or another package manager. get-pip.py does not
    coordinate with those tools, and may leave your system in an
    inconsistent state. You can use python get-pip.py --prefix=/usr/local/
    to install in /usr/local which is designed for locally-installed
    software.

Ensure pip, setuptools, and wheel are up to date¶

While pip alone is sufficient to install from pre-built binary archives,
up to date copies of the setuptools and wheel projects are useful
to ensure you can also install from source archives:

Unix/macOS

python3 -m pip install --upgrade pip setuptools wheel

Windows

py -m pip install --upgrade pip setuptools wheel

Optionally, create a virtual environment¶

See section below for details,
but here’s the basic venv [3] command to use on a typical Linux system:

Unix/macOS

python3 -m venv tutorial_env
source tutorial_env/bin/activate

Windows

py -m venv tutorial_env
tutorial_env\Scripts\activate

This will create a new virtual environment in the tutorial_env subdirectory,
and configure the current shell to use it as the default python environment.

Creating Virtual Environments¶

Python “Virtual Environments” allow Python packages to be installed in an isolated location for a particular application,
rather than being installed globally. If you are looking to safely install
global command line tools,
see Installing stand alone command line tools.

Imagine you have an application that needs version 1 of LibFoo, but another
application requires version 2. How can you use both these applications? If you
install everything into /usr/lib/python3.6/site-packages (or whatever your
platform’s standard location is), it’s easy to end up in a situation where you
unintentionally upgrade an application that shouldn’t be upgraded.

Or more generally, what if you want to install an application and leave it be?
If an application works, any change in its libraries or the versions of those
libraries can break the application.

Also, what if you can’t install packages into the
global site-packages directory? For instance, on a shared host.

In all these cases, virtual environments can help you. They have their own
installation directories and they don’t share libraries with other virtual
environments.

Currently, there are two common tools for creating Python virtual environments:

  • venv is available by default in Python 3.3 and later, and installs
    pip into created virtual environments in Python 3.4 and later
    (Python versions prior to 3.12 also installed Setuptools).

  • virtualenv needs to be installed separately, but supports Python 2.7+
    and Python 3.3+, and pip, Setuptools and wheel are
    installed into created virtual environments by default. Note that setuptools is no longer
    included by default starting with Python 3.12 (and virtualenv follows this behavior).

The basic usage is like so:

Using venv:

Unix/macOS

python3 -m venv <DIR>
source <DIR>/bin/activate

Windows

py -m venv <DIR>
<DIR>\Scripts\activate

Using virtualenv:

Unix/macOS

python3 -m virtualenv <DIR>
source <DIR>/bin/activate

Windows

virtualenv <DIR>
<DIR>\Scripts\activate

For more information, see the venv docs or
the virtualenv docs.

The use of source under Unix shells ensures
that the virtual environment’s variables are set within the current
shell, and not in a subprocess (which then disappears, having no
useful effect).

In both of the above cases, Windows users should not use the
source command, but should rather run the activate
script directly from the command shell like so:

Managing multiple virtual environments directly can become tedious, so the
dependency management tutorial introduces a
higher level tool, Pipenv, that automatically manages a separate
virtual environment for each project and application that you work on.

Use pip for Installing¶

pip is the recommended installer. Below, we’ll cover the most common
usage scenarios. For more detail, see the pip docs,
which includes a complete Reference Guide.

Installing from PyPI¶

The most common usage of pip is to install from the Python Package
Index
using a requirement specifier. Generally speaking, a requirement specifier is
composed of a project name followed by an optional version specifier. A full description of the supported specifiers can be
found in the Version specifier specification.
Below are some examples.

To install the latest version of “SomeProject”:

Unix/macOS

python3 -m pip install "SomeProject"

Windows

py -m pip install "SomeProject"

To install a specific version:

Unix/macOS

python3 -m pip install "SomeProject==1.4"

Windows

py -m pip install "SomeProject==1.4"

To install greater than or equal to one version and less than another:

Unix/macOS

python3 -m pip install "SomeProject>=1,<2"

Windows

py -m pip install "SomeProject>=1,<2"

To install a version that’s compatible
with a certain version: [4]

Unix/macOS

python3 -m pip install "SomeProject~=1.4.2"

Windows

py -m pip install "SomeProject~=1.4.2"

In this case, this means to install any version “==1.4.*” version that’s also
“>=1.4.2”.

Source Distributions vs Wheels¶

pip can install from either Source Distributions (sdist) or Wheels, but if both are present
on PyPI, pip will prefer a compatible wheel. You can override
pip`s default behavior by e.g. using its –no-binary option.

Wheels are a pre-built distribution format that provides faster installation compared to Source
Distributions (sdist)
, especially when a
project contains compiled extensions.

If pip does not find a wheel to install, it will locally build a wheel
and cache it for future installs, instead of rebuilding the source distribution
in the future.

Upgrading packages¶

Upgrade an already installed SomeProject to the latest from PyPI.

Unix/macOS

python3 -m pip install --upgrade SomeProject

Windows

py -m pip install --upgrade SomeProject

Installing to the User Site¶

To install packages that are isolated to the
current user, use the --user flag:

Unix/macOS

python3 -m pip install --user SomeProject

Windows

py -m pip install --user SomeProject

For more information see the User Installs section
from the pip docs.

Note that the --user flag has no effect when inside a virtual environment
— all installation commands will affect the virtual environment.

If SomeProject defines any command-line scripts or console entry points,
--user will cause them to be installed inside the user base’s binary
directory, which may or may not already be present in your shell’s
PATH. (Starting in version 10, pip displays a warning when
installing any scripts to a directory outside PATH.) If the scripts
are not available in your shell after installation, you’ll need to add the
directory to your PATH:

  • On Linux and macOS you can find the user base binary directory by running
    python -m site --user-base and adding bin to the end. For example,
    this will typically print ~/.local (with ~ expanded to the absolute
    path to your home directory) so you’ll need to add ~/.local/bin to your
    PATH. You can set your PATH permanently by modifying ~/.profile.

  • On Windows you can find the user base binary directory by running py -m
    site --user-site
    and replacing site-packages with Scripts. For
    example, this could return
    C:\Users\Username\AppData\Roaming\Python36\site-packages so you would
    need to set your PATH to include
    C:\Users\Username\AppData\Roaming\Python36\Scripts. You can set your user
    PATH permanently in the Control Panel. You may need to log out for the
    PATH changes to take effect.

Requirements files¶

Install a list of requirements specified in a Requirements File.

Unix/macOS

python3 -m pip install -r requirements.txt

Windows

py -m pip install -r requirements.txt

Installing from VCS¶

Install a project from VCS in “editable” mode. For a full breakdown of the
syntax, see pip’s section on VCS Support.

Unix/macOS

python3 -m pip install -e SomeProject @ git+https://git.repo/some_pkg.git          # from git
python3 -m pip install -e SomeProject @ hg+https://hg.repo/some_pkg                # from mercurial
python3 -m pip install -e SomeProject @ svn+svn://svn.repo/some_pkg/trunk/         # from svn
python3 -m pip install -e SomeProject @ git+https://git.repo/some_pkg.git@feature  # from a branch

Windows

py -m pip install -e SomeProject @ git+https://git.repo/some_pkg.git          # from git
py -m pip install -e SomeProject @ hg+https://hg.repo/some_pkg                # from mercurial
py -m pip install -e SomeProject @ svn+svn://svn.repo/some_pkg/trunk/         # from svn
py -m pip install -e SomeProject @ git+https://git.repo/some_pkg.git@feature  # from a branch

Installing from other Indexes¶

Install from an alternate index

Unix/macOS

python3 -m pip install --index-url http://my.package.repo/simple/ SomeProject

Windows

py -m pip install --index-url http://my.package.repo/simple/ SomeProject

Search an additional index during install, in addition to PyPI

Unix/macOS

python3 -m pip install --extra-index-url http://my.package.repo/simple SomeProject

Windows

py -m pip install --extra-index-url http://my.package.repo/simple SomeProject

Installing from a local src tree¶

Installing from local src in
Development Mode,
i.e. in such a way that the project appears to be installed, but yet is
still editable from the src tree.

Unix/macOS

python3 -m pip install -e <path>

Windows

py -m pip install -e <path>

You can also install normally from src

Unix/macOS

python3 -m pip install <path>

Windows

Installing from local archives¶

Install a particular source archive file.

Unix/macOS

python3 -m pip install ./downloads/SomeProject-1.0.4.tar.gz

Windows

py -m pip install ./downloads/SomeProject-1.0.4.tar.gz

Install from a local directory containing archives (and don’t check PyPI)

Unix/macOS

python3 -m pip install --no-index --find-links=file:///local/dir/ SomeProject
python3 -m pip install --no-index --find-links=/local/dir/ SomeProject
python3 -m pip install --no-index --find-links=relative/dir/ SomeProject

Windows

py -m pip install --no-index --find-links=file:///local/dir/ SomeProject
py -m pip install --no-index --find-links=/local/dir/ SomeProject
py -m pip install --no-index --find-links=relative/dir/ SomeProject

Installing from other sources¶

To install from other data sources (for example Amazon S3 storage)
you can create a helper application that presents the data
in a format compliant with the simple repository API:,
and use the --extra-index-url flag to direct pip to use that index.

./s3helper --port=7777
python -m pip install --extra-index-url http://localhost:7777 SomeProject

Installing Prereleases¶

Find pre-release and development versions, in addition to stable versions. By
default, pip only finds stable versions.

Unix/macOS

python3 -m pip install --pre SomeProject

Windows

py -m pip install --pre SomeProject

PIP stands for “Preferred Installer Program” or “Pip Installs Packages” and is a standard package manager for Python that enables users to install and manage additional libraries and dependencies not included in the standard Python library. To use PIP, you must install Python on your Windows machine.

This article provides a step-by-step guide on how to install and configure PIP on Windows, along with tips for managing Python packages effectively.

Prerequisities:

  • Windows (11, 10, 8 , 7)
  • Python (version 3.13.1)
  • Admin Rights

Verify Python Installation

Before installing PIP, you need to ensure that Python is already installed on your system. You can check this by running the following command in the command prompt

python --version

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

Python 3.13.1

If it is not installed, you can install it with the help of this article: How to install Python on Windows.

To get more knowledge about Python packages or modules, get hands-on in our Python course. This course will offer you basic to advanced insights into Python programming.

Installing Python PIP on Windows

Installing pip in Windows is very easy. You just need to follow the given steps to install pip and some additional steps to finally use it. By these steps, we can see how to pip install on Windows. To ensure proper installation and use of pip we need to tick this checklist to install pip Python:

  1. Download PIP
  2. Install PIP
  3. Verify Installation
  4. Add pip to environment variables

1. Download PIP

To install PIP, you’ll need the get-pip.py script. Let’s understand this in the below-mentioned detailed steps:

Method 1. Install Python pip using Python cURL

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.

Note: It will download the get-pip.py file.

Follow these instructions to pip windows install:

Step 1: Open Command Prompt

Press Win + R and type CMD and hit the enter button to open the cmd terminal using the Windows keyboard shortcut or alternatively, click on Start Menu and type “Command Prompt” and hit the enter button.

cmd-as-admin

Start Menu – Command Prompt – Run as admin

2. Installing PIP

Here, we have now used cURL to transfer the data requests, let’s check out the executed command in here:

Step 2: Transfer Data Request from a Server

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

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

Method 2. Manually Download and Install Python PIP on Windows

Python pip must be manually installed on Windows. We can pip install in Python by manually installing it. 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.

1.1 Download PIP

This is another method for downloading PIP manually. Let’s check down the steps below:

Step 1: Download the get-pip-py Script

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 Directory

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

2.2 Installing PIP

Now, in the next two steps, we will understand how you can install PIP in Python environment. Let’s check them out:

Step 3: Execute the command to Install Python

get-pip.py is a bootstrapping script that enables users to install pip in Python environments. Here, we are installing pip python3. Run the command given below:

python get-pip.py

Step 4: Wait Untill You Get the Confirmation

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

3. Verify the PIP Installation

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 -Vorpip --version

4. 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 adding pip to path Windows 10 and set the Path:

Step 1: Locate te PIP installation directory

  • You are likely to get this in: C\Python33\Scripts\

Step 2: Add to the PATH

  • Go to System and Security > System in the Control Panel
  • 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:\Python33\Scripts\ and select OK.

Step 3: Verify

  • Open the command prompt and type the following command to verify the PIP installation:
pip --version

How to Upgrade Pip On Windows

pip can be upgraded using the following command:

python -m pip install -U pip

How to Downgrad PIP on Windows

It may happen sometimes that your current pip version is not supporting your current version of python or machine.

To fix that, you can downgrade your pip version with the help of Python pip install command and the following command.

Note: You can mention the version you want to install

python -m pip install pip==17.0

If you followed these steps, you will not face any issues while installing pip on windows. We have also discussed methods to upgrade or downgrade pip version in case you face any issues.

Managing Python Packages with PIP

Once PIP is installed, you can use it to manage Python packages. Here are some common commands:

  • Install a Package: To install a package, use:
    pip install package_name
  • Uninstall a Package: To remove a package, use:
    pip uninstall package_name
  • List Installed Packages: To see all installed packages, use:
    pip list
  • Show Package Information: To get detailed information about a package, use:
    pip show package_name
  • Search for Packages: To search for packages in the Python Package Index (PyPI), use:
    pip search package_name

Troubleshooting Tips

1. Python Not Recognized

Always ensure that Python is added to the PATH during the installation. In case, if it’s not, you can modify the PATH manually.

2. Permission Errors

Try running the Command Prompt as an administrator access.

3. SSL Errors

Ensure that te date and time is correct of your system (as SSL certificates usually relies on actual system clocks.)

Also Read

  • How to install PIP in Linux?
  • How to install pip in macOS?
  • Download and install pip Latest Version

Conclusion

By following this guide, you can successfully download, install, upgrade, downgrade, and manage PIP on Windows seamlessly. With PIP installed in your system, you can easily manage to Python packages and enhance your Python development environment. Whether you’re a beginner or an experienced developer, understanding how to work with PIP is essential for efficient Python programming.


pip is a package management tool for Python that allows you to install and manage software packages from the Python Package Index (PyPI). The name pip originated as an acronym for Pip Installs Packages.

Most modern Python versions include pip by default. However, if it is missing, you can install it manually.

This guide will explain how to check if pip is installed, install it using two different methods, and upgrade or configure it on Windows.

draft - How to Install pip on Windows

Prerequisites

  • A Windows system.
  • Access to Command Prompt or PowerShell.
  • Python installed and added to PATH.

Note: Python is usually preinstalled on Windows. If not, the easiest method to get it is with Windows Package Manager. To install Python with winget, run: winget install Python.Python.

Check if pip Is Installed on Windows 

Python’s latest versions include pip, but some installations may not. Before installing pip on Windows, check if the system already has it.

Launch the command prompt and type the following command:

pip --version
pip not installed on windows

If pip is installed, the output displays the installed version. In case the system responds with an error message like the one above, follow one of the methods in this tutorial to install it.

Method 1: Install pip on Windows Using ensurepip

The ensurepip module is built into Python and can install pip if it’s missing. It’s useful in environments where pip was not included by default, such as embedded Python installations.

To install pip, run the following command:

python -m ensurepip --upgrade
python -m ensurepip --upgrade cmd output

After the installation completes, verify the pip installation with:

pip --version
pip --version cmd output

Method 2: Install pip on Windows Using get-pip.py

To install pip using this method, download the get-pip.py script using curl, then run it. Follow the steps below to install pip using this method.

Step 1: Download pip get-pip.py

Download the get-pip.py script with the following command:

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

Note: To check if the link in the command is up to date, visit the official site for get-pip.py. If you can access the file directly and it doesn’t print any errors, the link is still valid.

Step 2: Install pip on Windows

If you used the get-pip.py script to download pip, run the following Python command to install it:

python get-pip.py
python get-pip.py cmd output

Note: In some cases, get-pip.py outputs the installation location. If this happens, note the PATH to use when adding pip to your system’s PATH variable.

Step 3: Verify Installation

To test whether the installation was successful, type the following command:

pip --version
cmd output for pip --version

Step 4: Add pip to PATH

To run pip from any location and as a standalone command, add it to Windows environment variables.

Before modifying environment variables, check whether pip is already in your system’s PATH. Run this command:

where pip
where pip cmd output

If the command returns a valid PATH, skip this step. If the command cannot find the PATH, it returns the error:

where pip cmd output no path

Follow these steps to add pip manually:

1. Locate the pip installation directory, which is, by default, in the Scripts subdirectory of your Python installation. A typical path is:

C:\Users\[YourUsername]\AppData\Local\Programs\Python\PythonXX\Scripts

Replace [YourUsername] with your actual Windows username and PythonXX with the Python version.

In this tutorial, the path is:

C:\Users\PC\AppData\Local\Programs\Python\Python313\Scripts

Note it because you will need it in the coming steps.

2. Open the Start menu, search for Environment Variables, and press Enter.

Edit the environment variables

3. Click the Environment Variables button.

Click the Environment Variables button.

4. Double-click the Path variable to edit it.

Double-click the Path variable to edit it.

Note: Modify User variables for a single user or System variables to apply changes for all users.

5. Select New and add the directory where pip is installed, which you located and noted earlier,

pip installation directory

6. Click OK to save the changes.

7. Open a new command prompt session and run the following command to test the changes:

pip help
pip help cmd output

If the command does not work, try using pip3 instead of pip. Alternatively, add the directory where Python is installed to PATH and repeat the process.

Step 5: Configuration

The configuration file for pip exists in several locations on the system, including global, user-specific, and site-specific paths.

The configuration provides insight into how pip is set up and helps find installation problems or unexpected behavior.

To see the current configuration settings, run:

pip config -v list
pip config -v list cmd output

The command shows the possible global, user, and site locations for the pip.ini configuration file. If you need to adjust pip’s behavior, edit the appropriate pip.ini file based on these locations.

Upgrade or Downgrade pip on Windows 

New versions of pip are released occasionally. These updates improve functionality or are necessary for security purposes.

To upgrade pip on Windows, run:

pip install --upgrade pip

Downgrading is necessary if a new version of pip starts performing badly. To downgrade pip to a prior version, specify the version you want.

Use the following syntax:

python -m pip install pip==[version_number]

Conclusion

This guide explained two ways to install pip on Windows and elaborated on how to add pip to PATH when necessary. Additionally, it showed how to upgrade or downgrade pip.

Next, check out our guide and learn how to install NumPy, a powerful Python library for numerical computing, using pip.

Was this article helpful?

YesNo

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Где меняется пароль в windows 10
  • Enables remediation and protection of windows update components
  • Яндекс музыка windows store
  • Для чего папка msocache в windows 10
  • Asrock p43twins1600 windows 10