Created
March 17, 2019 02:33
-
-
Save codeliger/15f7d10a20092a4d8035c8c6de6fdd94 to your computer and use it in GitHub Desktop.
pip upgrade all packages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Upgrades all pip packages to the latest version | |
''' | |
from subprocess import check_output, call | |
import json | |
PYTHON_VERSION = '3.7' | |
CMD_OUTDATED_PACKAGES = f'python -m pip list --format json -o' | |
CMD_INSTALL_UPGRADE = 'python -m pip install {} --user --upgrade' | |
packages = json.loads(check_output(CMD_OUTDATED_PACKAGES.split())) | |
for package in packages: | |
call(CMD_INSTALL_UPGRADE.format(package['name']).split()) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment