- List Outdated Packages
- Update All Python Packages
- Update Specific Packages On Windows Or Linux
- References
pip list --outdated
pip freeze | %{$.split('==')[0]} | %{pip install --upgrade $}
To upgrade all packages using pip with grep on Ubuntu Linux
pip3 list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U
To upgrade all packages using pip with awk on Ubuntu Linux
pip3 list -o | cut -f1 -d' ' | tr " " "\n" | awk '{if(NR>=3)print}' | cut -d' ' -f1 | xargs -n1 pip3 install -U
-
Freeze packages
pip freeze > requirements.txt
-
Edit
requirements.txt
(set the versions you need for your project) -
Upgrade to the newer/older versions you've setted
pip install -r requirements.txt --upgrade
https://www.activestate.com/resources/quick-reads/how-to-update-all-python-packages/