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
pip install [package_name] -U
pip install bs4 --upgrade or
pip install bs4 --U
Here, bs4 is the pip directory name of module beautifulsoup4.
The following screenshot shows the upgrade of a python module called gtts using the above-specified pip command.
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.