Upgrade pip

In this tutorial, we are going to discuss the commands to upgrade a pip in windows, Linux, and macOS systems but first, let’s have a short introduction to Python Pip.

What is pip?

A pip is a package manager in python, it is used to install, delete, upgrade and downgrade new packages. A pip can install all those essential packages which are required for doing a specific task. The main advantage of pip is it makes coding easier and more manageable for the developer.

I hope you got the concept of pip in python now let’s first see how to check the pip version in python:

Run the following command in the windows commands prompt for checking the pip version.

pip –version
#or you can type  
pip3 –version

Then you will see an output like this.

Output

C:\Users\coder>pip --version
pip 22.1.2 from C:\Users\coder\AppData\Local\Programs\Python\Python310\lib\site-packages\pip (python 3.10)
C:\Users\coder>

How to upgrade pip in Python – (Windows)

An upgrade pip command is used to update the pip version in python, an upgraded pip comes with a lot of new packages. You can take advantage of an updated pip and use its updated features.

Execute the following command to upgrade a pip.

python -m pip install --upgrade pip

You will see an output like the below.

Output

Downloading pip-22.2.1-py3-none-any.whl (2.0 MB)
    
---------------------------------------- 2.0/2.0 MB 757.1 kB/s eta 0:00:00
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 22.1.2
    Uninstalling pip-22.1.2:
     
Successfully uninstalled pip-22.1.2
Successfully installed pip-22.2.1

After successfully updating the pip you can check the pip version by using the same command.

pip --version

How to upgrade pip in Python – (Linux)

pip install -U pip

#or you can use

pip install --upgrade pip

You can check the updated pip version in Linux by running the same command which we used for windows.

pip –version

In case the above command did not work so run these sudo commands.

sudo -H pip3 install --upgrade pip
sudo -H pip2 install --upgrade pip

Hope it will work for you.

How to upgrade pip in Python – (macOS)

python -m pip install --upgrade pip

suppose while working with the new pip version and you didn’t like any feature or package and you want your pip version back so you can downgrade the pip as well see the command below.

pip install –upgrade pip==22.1.2
#or you can use
pip3 install –upgrade pip==22.1.2

Conclusion

In this tutorial we discussed how to upgrade a pip in python, first, we saw a short introduction to pip in python then we saw how to check the pip version in windows and we saw the commands for upgrading a pip.

We also discussed how can we upgrade a pip using Linux and macOS environments, we saw those commands as well.

In the end, we saw the command for downgrading a pip in python if we don’t need it.

That’s all for today hope you like the tutorial if you have any queries regarding this article so feel free to contact us below. Thanks for reading.

Leave a Comment