Last Updated: February 25, 2016
·
1.187K
· MarcQualie

Upgrade all Pip Dependencies

I've recently started using Python and virtualenv and I've inherited a few codebases from people and found that the pip dependencies were out of date. I couldn't find any documentation on how to upgrade all pip dependencies so I decided to write this little snippet. It was originally inspired by a Stack overflow answer but I've built upon it to work with virtual env and save the results back to a file at the end.

env/bin/pip freeze | grep -v '^\-e' | cut -d = -f 1 | xargs env/bin/pip install -U && env/bin/pip freeze > requirements.txt

This assumes your virtualenv is installed in the "env" subdirectory.