How To Update and Upgrade Pip? – POFTUT

How To Update and Upgrade Pip?


Pip is a tools or command used to manage Python packages, libraries. With the help of Pip, we can search, install, update, remove Python packages. But what about the Pip itself, “How to update or upgrade Pip?”.

Display and Check Current Python Version

We will start checking the Python version. We will use the -v options or just enter the interactive Python shell in order to display and check the current Python version. We will check both Python2 and Python3 versions like below.

$ python2 --version

$ python3 --version

$ python --version
Display and Check Current Python Version
Display and Check Current Python Version

Display and Check Current Pip Version

Before updating the pip we will check already installed pip versions. Like Python versions like 2 and 3 pip has versions which are called pip2 and pip3. We will use the -V option in order to print the pip version. We will use pip2 for Python2 and pip3 for Python3. Only pip command is used for default Python version where it is Python2 in this case.

$ pip2 -V

$ pip3 -V

$ pip -V
Display and Check Current Pip Version
Display and Check Current Pip Version

Update/Upgrade Pip with Pip Itself

The first and the most popular way to update or upgrade pip tool is using itself. We will update pip like a regular Python package by using the install -U upgrade option and provide the package name as pip. The package name for the Python version is not important but we have to use proper pip command version like pip2 op pip3 .

$ pip2 install -U pip

$ pip3 install -U pip
Upgrade Pip with Pip Itself
Upgrade Pip with Pip Itself

We can again check the version of the pip after update/upgrade with the same commands. We will see that their versions are jumped from 9.0.1 to 19.2.3 for both pip2 and pip3. Also, default pip command version is changed to the Python3 or pip3 where we issue the pip -V command.

LEARN MORE  How To Use Python Pip Command and Tutorial with Examples?
Update/Upgraded pip2, pip3 Commad Versions
Update/Upgraded pip2, pip3 Command Versions

Update/Upgrade Pip via Python On Windows

We can update the pip with the Python command or interpreter too. We will provide the -m option in order to provide the pip module with the install --upgrade option. At least we will provide the package name as pip. This is the same operation with updating pip but the implementation is a bit different.

$ python2 -m pip install --upgrade pip

$ python3 -m pip install --upgrade pip

$ python -m pip install --upgrade pip

Pip with easy_install Command

easy_install is another useful tool provided by Python. We can use easy_install in order to update and upgrade existing pip, pip2 or pip3 command. We just need to provide the package name to easy_update where it will install or upgrade given package. While using this you may need privileges like root or Administrator where you need to open the command line as Administrator in Windows operating systems.

$ easy_install -U pip

Downgrade Specific Version of Pip with Pip Itself

Up to now we have updated/upgraded to the latest version but this not always the case. We may need to upgrade/update or downgrade to the specific pip version. We can specify the version we want to install/update/upgrade/downgrade like below. We will use a double equation sign after the package name and provide the version number. In this example we will install/update/upgrade/downgrade pip version 18.1 .

$ pip install -U pip==18.1

$ pip3 install -U pip==18.1

$ pip2 install -U pip==18.1

Leave a Comment