How To Upgrade A Python Package With PIP?

Python PIP Upgrade Or Update Package

This is a Quick Tutorial on how you can easily update or upgrade already installed python packages using pip. Just run this single line command.

pip install [package_name] --upgrade

or Shortly,

pip install [package_name] -U

Example. pip install bs4 --upgrade or pip install bs4 --U

Here, bs4 is the pip directory name of the module beautifulsoup4.

The following screenshot shows the upgrade of a python module called gtts using the above-specified pip command.

Pip Package Upgrade

You can also perform the upgrade as a root user using sudo. All you need to do is to place the sudo keyword before the command. In that case, you’ll also be asked for the root user password.

sudo pip install [package_name] --upgrade

Note. For the users having two different versions of python and pip installed, let’s say pip for the python version 2.7 and python version 3.4+, then you may require to write pip or pip3 as per the environment variables set up on your machine.

Leave a Reply

Your email address will not be published. Required fields are marked *