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 Overflow
🌐
pip
pip.pypa.io › en › stable › development › architecture › upgrade-options
Options that control the installation process - pip documentation v26.1.2
This option affects which packages are allowed to be installed. It is only relevant if --upgrade is specified (except for the to-satisfy-only option mentioned below). The base behaviour is to allow packages specified on pip’s command line to be upgraded.
🌐
Note.nkmk.me
note.nkmk.me › home › python
How to Use pip (Install, Update, Uninstall Packages) | note.nkmk.me
April 18, 2025 - $ pip install --upgrade <package-name> $ pip install -U <package-name>
🌐
pip
pip.pypa.io › en › stable › installation
Installation - pip documentation v26.1.2
Python comes with an ensurepip module[1], which can install pip in a Python environment. Linux · $ python -m ensurepip --upgrade MacOS · $ python -m ensurepip --upgrade Windows · C:> py -m ensurepip --upgrade · More details about how ensurepip works and how it can be used, is available in the standard library documentation.
🌐
pip
pip.pypa.io › en › latest › installation
Installation - pip documentation v26.2.dev0
Python comes with an ensurepip module[1], which can install pip in a Python environment. Linux · $ python -m ensurepip --upgrade MacOS · $ python -m ensurepip --upgrade Windows · C:> py -m ensurepip --upgrade · More details about how ensurepip works and how it can be used, is available in the standard library documentation.
🌐
OperaVPS
operavps.com › docs › pip update all packages to latest version
Pip Update All Packages to Latest Version [Pip Upgrade]
5 days ago - Upgrades each package individually, ensuring you pip upgrade all packages efficiently. If you only want to update particular packages, you can manually specify them: sudo pip install --upgrade package_name_1 package_name_2
🌐
Data to Fish
datatofish.com › upgrade-pip
How to Upgrade pip
Make sure that Python was added to your Windows path. If so, you can upgrade pip by executing the following command in your Command Prompt: python -m pip install --upgrade pip · Upgrade pip by running the following command in your terminal: pip install --upgrade pip ·
Find elsewhere
🌐
iO Flood
ioflood.com › blog › pip-update-package
PIP Update Packages in Python | Practical Commands
August 12, 2024 - You can update a Python package using pip with a simple command: pip install --upgrade package-name.
🌐
NBShare
nbshare.io › notebook › 228803083 › How-to-Upgrade-Python-PIP
How to Upgrade Python PIP - Nbshare Notebooks
To install the version we can either run the command pip install --upgrade pip or do pip install pip==19.3.1
🌐
MTU Service Desk
servicedesk.mtu.edu › TDClient › 1801 › Portal › KB › PrintArticle
Installing, uninstalling, or upgrading Python modules using Pip (Linux)
Python modules are packages, or modules, which can be imported into a project to use. This includes packages like matplotlib, numpy, flask, and many more. You can install and uninstall packages for Python with the Pip package manager. Python modules that are stored on your home drive will only ...
🌐
GitHub
gist.github.com › hritik5102 › 35b2886771d60fc6d7a95b6fd55c62ba
How To Update All Python Packages · GitHub
plus one more spell: pip list --format=freeze | awk -F '==' '{print $1}' | xargs pip install --upgrade
🌐
Python⇒Speed
pythonspeed.com › articles › upgrade-pip
Why you should upgrade pip, and how to do it
March 21, 2023 - In order to get the latest and greatest packages, without compilation, you need to upgrade to a recent version of pip. How you do it depends on your environment. In general, you can do pip install --upgrade pip and call it a day.
🌐
freeCodeCamp
freecodecamp.org › news › pip-upgrade-and-how-to-update-pip-and-python
Pip Upgrade – And How to Update Pip and Python
March 14, 2023 - In cases when you want to update only Pip, open your terminal and run pip3 install --upgrade pip.
🌐
Stack Abuse
stackabuse.com › bytes › how-to-update-pip-in-a-virtual-environment
How to Update pip in a Virtual Environment
September 6, 2023 - Venv is the built-in Python virtual environment system. If you're using venv, you can upgrade pip within your virtual environment by first activating the environment and then running the pip upgrade command. Here's how you do it: $ source ./venv/bin/activate (venv) $ python -m pip install --upgrade pip