pip is just a PyPI package like any other; you could use it to upgrade itself the same way you would upgrade any package:
Copypip install --upgrade pip
On Windows the recommended command is:
Copypy -m pip install --upgrade pip
Answer from Cairnarvon on Stack Overflowpip is just a PyPI package like any other; you could use it to upgrade itself the same way you would upgrade any package:
Copypip install --upgrade pip
On Windows the recommended command is:
Copypy -m pip install --upgrade pip
The more safe method is to run pip though a python module:
Copypython -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.
Ways to update pip (and when updating is a good idea) - Packaging - Discussions on Python.org
python - How to update/upgrade a package using pip? - Stack Overflow
Trying to update PIP.
Pip update all with dependency management
Can I use `pip install --upgrade pip` to upgrade PIP?
Why should I update Pip regularly?
How often should I upgrade PIP?
Videos
» pip install pip
I usually just run the following commands to upgrade both pip2 (=pip by default) and pip3:
sudo -H pip3 install --upgrade pip
sudo -H pip2 install --upgrade pip
You must make sure that you upgrade the version (for Python 2 or 3), which you want to react on the command pip without number, last.
Also please note that this keeps the old packaged versions installed through apt-get or any other package manager, but adds new versions which have nothing to do with the system packages. The pip-installed packages will be preferred, but you should not remove the apt-get-installed ones either, because the package manager can't know that any pip version is installed otherwise.
I think the
pip install --upgrade pip
command does not work properly anymore. The correct command should be:
for Python 3:
python3 -m pip install --upgrade pipfor Python 2:
python2 -m pip install --upgrade pip
P.S. If you want to make sure your other Python packages are also up to date, follow the instructions here.
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
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