This is the way
Copypip install <package_name> --upgrade
or in short
Copypip 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.
Copypip install <package_name> --upgrade --user
Answer from borgr on Stack OverflowThis is the way
Copypip install <package_name> --upgrade
or in short
Copypip 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.
Copypip install <package_name> --upgrade --user
For a non-specific package and a more general solution, you can check out pip-review. A tool that checks what packages could/should be updated.
To install:
Copy$ pip install pip-review
Then run:
Copy$ pip-review --interactive
requests==0.14.0 is available (you have 0.13.2)
Upgrade now? [Y]es, [N]o, [A]ll, [Q]uit y
Videos
To upgrade pip using pip is a bit different than regular command. Use
python -m pip install --upgrade pip
Here python -m will read the pip library file as a script and you will be able to update.
If you were like me you had created a virtual environment in a project folder.
python -m venv env
So in order to make the pip upgrade work, go into the Scripts folder of the env folder.
Then run .\python -m pip install --upgrade pip.
Ditto with any pip installs. Same folder .\pip install ....
The .\ pins it to the command in the current folder, be it pip or python.
(I was doing this on Windows. But ./ would be the equivalent for Unix variants)
PS: I also ran those commands as Administrator - so sudo the commands if things fails.
pip is just a PyPI package like any other; you could use it to upgrade itself the same way you would upgrade any package:
pip install --upgrade pip
On Windows the recommended command is:
py -m pip install --upgrade pip
The more safe method is to run pip though a python module:
python -m pip install -U pip
On windows there seem to be a problem with binaries that try to replace themselves, this method works around that limitation.