HiveBrain v1.2.0
Get Started
← Back to all entries
snippetpythonCriticalCanonical

How to update/upgrade a package using pip?

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
howupgradepackagepipupdateusing

Problem

What is the way to update a package using pip? These commands 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)

Solution

This is the way

pip install  --upgrade


or in short

pip install  -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  --upgrade --user

Code Snippets

pip install <package_name> --upgrade
pip install <package_name> -U
pip install <package_name> --upgrade --user

Context

Stack Overflow Q#47071256, score: 1395

Revisions (0)

No revisions yet.