Monthly Archives: April 2018

How to update python packages to the latest version

Recently I wanted to update my python packages and really wasn’t a way to easily update them until I ran into Stack Overflow question on how to do it. Which it worked neatly.

Here are the steps on how to do it in your python environment

pip list --outdated --format=freeze #list outdated packages
pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U

If you have a specific python version, you can invoke it this way

pip2.7 list --outdated --format=freeze #list outdated packages
pip2.7 freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 sudo -H pip2.7 install -U

Sources
https://stackoverflow.com/questions/2720014/upgrading-all-packages-with-pip