Fix Python – How to update/upgrade a package using pip?


Asked By – borgr

What is the way to update a package using pip?
those do not work:

pip update
pip upgrade

I know this is a simple question but it is needed as it is not so easy to find (pip documentation doesn’t pop up and other questions from stack overflow are relevant but are not exactly about that)

Now we will see solution for issue: How to update/upgrade a package using pip?


The way is

pip install <package_name> --upgrade

or in short

pip install <package_name> -U

Using sudo will ask to enter your root password to confirm the action, but although common, is considered unsafe.

If you do not have a root password (if you are not the admin) you should probably work with virtualenv.

You can also use the user flag to install it on this user only.

pip install <package_name> --upgrade --user

This question is answered By – borgr

This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0