Last Updated : 14 Aug, 2024
Comments
Improve
In this tutorial, we will see how to Upgrade PIP on Windows. We will cover how to upgrade, check the version, and also how to downgrade PIP to the previous version.
What does pip () do?
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. Here, we will the focus on the following topics:
- Upgrade PIP on Windows
- Check the current version of PIP
- Downgrade PIP to previous version
Note: If your system is not recognising PIP, downloaded using this article PIP.
Upgrade PIP on Windows
In order to upgrade PIP on Windows, just open the Window’s Command Prompt and type the following command:
python -m pip install --upgrade pip
Note that this command will only work if you have already added Python to Window Path.
Upgrade and Managing Multiple Python Versions
If you want to update specific version of Python of your machine, You can follow the below steps:
Step 1: Type Command Prompt in Window’s search box
Step 2: Open the Command Prompt and you will see the following screen.
C:\Users\Shivang>
Step 3: Type “cd” in the Command Prompt to ensure that your starting point has only the drive name:
C:\Users\Shivang>cd\
Step 4: Now press Enter and you will see the following screen.
C:\>
Step 5: Locate your original Python Application path ( the folder in which you originally installed Python ).
C:\Users\Shivang\AppData\Local\Programs\Python\Python39
Step 6: After retrieving the original Python Application Path, type “cd” followed by your Python Application Path:
C:\>cd C:\Users\Shivang\AppData\Local\Programs\Python\Python39
Step 7: Press Enter and then type this following command in your Command Prompt window:
python -m pip install --upgrade pip
For example,
C:\Users\Shivang\AppData\Local\Programs\Python\Python39>python -m pip install ––upgrade pip
Step 8: You will notice that the latest PIP version is installed
Check the Version of PIP
To check the current version of PIP, just type/copy the following command in your Command Prompt:
pip --version
Downgrade PIP
In previous section, we have covered how to upgrade and check the version of PIP in Windows. But what if you like to revert back to a previous version of PIP? You can easily downgrade your Window’s PIP version to it’s previous version. How ? let’s see,
To downgrade the PIP version just type the following command:
python -m pip install pip==version_name
Suppose you wanted to downgrade your PIP version to 18.1 then,
python -m pip install pip==18.1
You will see the version of PIP that you wanted to install is installed.
Successfully installed pip-18.1
How to Upgrade PIP on Windows – FAQs
How to Update pip Version in Windows
To update the pip version on a Windows system, you can use the command prompt. Here are the general steps:
- Open Command Prompt: You can do this by searching for
cmd
in the Start menu.- Run the Update Command: Use the following command to update pip to the latest version:If you have multiple Python versions installed, you might need to specify the Python version:
python -m pip install --upgrade pip
py -3.8 -m pip install --upgrade pip
How Do I Upgrade a Specific Version of pip?
To upgrade pip to a specific version, you can use the pip install command with the
==
version specifier. For example, to install pip version 20.2.3, you would run:python -m pip install pip==20.2.3
How to Install the Latest Version of pip in CMD
To install the latest version of pip using the Windows Command Prompt (CMD), follow these steps:
- Open Command Prompt: Search for
cmd
in the Start menu and open it.- Run the Installation Command: Execute the command to upgrade pip to the latest version:This command ensures that pip is upgraded to the latest version available.
python -m pip install --upgrade pip
How to Upgrade pip to 23.3.2
To upgrade pip to a specific version like 23.3.2, you would specify that version in the pip install command. Ensure that this version exists and is available in the PyPI repository. Here’s how you do it:
python -m pip install pip==23.3.2
How Do I Update All Installed Python Packages?
To update all installed Python packages to their latest versions, you can use the following approach:
- Generate a List of Installed Packages: First, generate a list of all installed packages and their versions.
- Modify the Requirements File: Open
requirements.txt
and replace the==
with>=
for each package line. This tells pip to install the latest version available.- Upgrade Packages Using the Modified File:
pip freeze > requirements.txt
pip install --upgrade -r requirements.txt
This method updates all packages specified in the
requirements.txt
file to the latest versions available on PyPI, respecting any version constraints specified in the file. Keep in mind that updating all packages blindly can sometimes lead to dependency conflicts or breakages, especially in complex projects, so it may be prudent to update packages individually and test your application after each update.
Next Article
How to update Python on Windows?