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

Leave a Comment