pip Cheat Sheet/Upgrade a package

Upgrade one package to the latest matching version.

Section: Install and Upgrade

Upgrade a package

bash
bash
python -m pip install --upgrade requests
Explanation

`--upgrade` tells pip to replace an installed version when a newer one is available.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Install and Upgrade
Install a package
Install the latest version of a package.
OpenIn sheetbashsame section
Install a specific version
Pin installation to an exact version.
OpenIn sheetbashsame section
Install with a version range
Allow a controlled range of versions.
OpenIn sheetbashsame section
Upgrade pip itself
Update pip in the active interpreter.
OpenIn sheetbashsame section
Uninstall a package
Remove an installed package.
OpenIn sheetbashsame section
Uninstall without prompt
Remove a package non-interactively.
OpenIn sheetbashsame section