Update Pip Packages With a Python Script

A simple way to update all of your pip packages by running a Python script:

import pip
from subprocess import call

packages = [dist.project_name for dist in pip.get_installed_distributions()]
call("pip2 install --upgrade " + ' '.join(packages), shell=True)

That’s it, just run the script and all of your packages should update to their newest version.

Script credit to this smart stackoverflow poster.

© 2014 - 2021 · Home ·