How to update a Python package using pip

Problem description

How to update Python packages using pip in the terminal.

Problem solution

Latest version

You can use the --upgrade flag during calling pip install to upgrade any package to its latest version:

pip install --upgrade <any_package>

Or shorter:

pip install -U <any_package>

All you have to do is write name of desired package instead <any_package>.

Specific version

To upgrade any package to specific version all you have to do is add == and name of version after the package name:

pip install --upgrade <any_package>==1.2.3

Or shorter:

pip install -U <any_package>==1.2.3