DevOPS

How to Install PIP on Windows

install pip on windows

Introduction

PIP is a package management system that installs and manages software packages written in Python. It stands for “Preferred Installer Program” or “Pip Installs Packages.” The utility manages PyPI package installations from the command line.

Installing PIP on Windows is simple. It requires downloading the installation package, opening the command line, and launching the installer.

This tutorial will show how to install PIP on Windows using two methods. We will also show you how to check, upgrade, and configure PIP.

How To Install PIP to Manage Python Packages On Windows

Note: The latest versions of Python come with PIP pre-installed, but older versions require manual installation. The following guide is for version 3.4 and above. If you are using an older version of Python, follow our guide to upgrade Python.

Prerequisites

Checking if You Have PIP Installed on Windows

PIP is automatically installed with Python 3.4.x+. However, depending on how Python was installed, PIP may not be available on the system automatically. Before installing PIP on Windows, check if it is already installed:

1. Launch the command prompt window by pressing Windows Key + X and clicking Run.

2. Type in cmd.exe and hit enter.

Alternatively, type cmd in the Windows search bar and click the “Command Prompt” icon.

3. Type the following command in the command prompt:

pip help
pip help not recognized Windows CMD output

If PIP responds with an error message saying the command is not recognized, follow one of the methods below to install it.

Note: Check out our other guides to learn how to install PIP on other operating systems:

Method 1: Install PIP on Windows Using get-pip.py

The first method uses cURL to download the installation file and additional configuration steps post-installation. Follow the steps below to install PIP using this method.

Step 1: Download PIP get-pip.py

Before installing PIP, download the get-pip.py file. Run the following cURL command in the command prompt:

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

Wait for the download to complete before proceeding to the next step.

Step 2: Installing PIP on Windows

To install PIP, run the following Python command:

python get-pip.py
python get-pip.py CMD output

Note the location from the output warning, which will be required to add PIP to the Path environment variable.

Step 3: Verify Installation

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

python -m pip help
python -m pip help CMD output

If PIP is installed, the program runs without any errors. The output shows the software’s location and a list of pip commands.

Repeat the installation process or use the second method if you receive an error.

Step 4: Add Pip to Path

To run PIP from any location and as a standalone command, add it to Windows environment variables. Doing so resolves the “not on Path” error.

To add PIP to Path, follow these steps:

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

Start Environment Variables search result

2. Click the Environment Variables button.

System properties Environment Variables button

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

Environment Variables list Path variable

4. Select New and add the directory where PIP is installed.

Path Python pip new entry

5. Click OK to save the changes.

6. 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

In Windows, the PIP configuration file can be found in several locations. To view the current configuration and list all possible file locations, use the following command:

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. Below the locations are the current configuration settings, if any.

Method 2: Install PIP on Windows Using ensurepip

The second method uses Python to install PIP without downloading or running any scripts. Enter the following command in the command prompt:

python -m ensurepip --upgrade
python -m ensurepip --upgrade CMD output

Wait for the installation to complete. Check that PIP is installed correctly with the following command:

pip --version
pip --version CMD output

The command outputs the PIP version to the console.

Note: If the command is not found, add Python to the Path environment variable. Or, try using the command as pip3 instead of pip.

Upgrading PIP for Python on Windows

New versions of PIP are released occasionally. These versions may improve the functionality or be obligatory for security purposes.

To upgrade PIP on Windows, enter the following in the command prompt:

pip install --upgrade pip

This command uninstalls the previous version and then installs the most current version of PIP.

Downgrading PIP Version

Downgrading may be necessary if a new version of PIP starts performing undesirably. To downgrade PIP to a prior version, specify the version you want.

To downgrade PIP, use the following syntax:

python -m pip install pip==[version_number]

For example, to downgrade to version 18.1, run:

python -m pip install pip==18.1
python -m pip install downgrade CMD output

You should now see the version of PIP that you specified.

Note: Learn how to update packages using winget upgrade command.

Conclusion

After reading this guide, you’ve installed PIP and can manage your Python packages on Windows.

Next, check out our guide and learn how to install NumPy using PIP.

Đăng ký liền tay Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !

Add Comment

Click here to post a comment

Đăng ký liền tay
Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !