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
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:
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.
python - How to update/upgrade a package using pip? - Stack Overflow
Error when trying to update pip via cmd
Updating all of your python pip packages
Why is pip upgrading itself and installing packages in an older python folder and not in the version i've got installed?
Can I use `pip install --upgrade pip` to upgrade PIP?
How often should I upgrade PIP?
Will upgrading PIP affect my existing Python packages?
Videos
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
» pip install pip-upgrade-tool
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.