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 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.
pip is designed to upgrade python packages and not to upgrade python itself. pip shouldn't try to upgrade python when you ask it to do so.
Don't type pip install python but use an installer instead.
Basically, pip comes with python itself. Therefore it carries no meaning for using pip itself to install or upgrade python.
Thus, try to install python through installer itself, visit the site https://www.python.org/downloads/ for more help.
How to update Python with pip or Terminal on Linux?
python - How do I update/upgrade pip itself from inside my virtual environment? - Stack Overflow
You can't use pip on Ubuntu 23.04 anymore
How to change Python and Pip version in Ubuntu
Videos
New to Linux (Linux Mint 20) and it's a bit different from Windows.
I'm stuck on Python 3.8 and want to update to python 3.9.
Thanks for any help provided.
UPDATE | Thanks to the fellow members for the support and I found this [ https://www.reddit.com/r/learnpython/comments/kwa428/updating_python_on_linux/ ] and it suggests not to update the system files, including the python installed with the system.
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.