Last active
November 12, 2015 18:31
-
-
Save timdetering/295c260a735282985660 to your computer and use it in GitHub Desktop.
This file contains 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
#! /usr/bin/python | |
import pip | |
import sys | |
from subprocess import call | |
def pip_upgrade(): | |
if sys.version_info > (3, 0): | |
# Python 3 code in this block | |
pip_cmd = "pip3" | |
else: | |
# Python 2 code in this block | |
pip_cmd = "pip" | |
for dist in pip.get_installed_distributions(): | |
cmd = "{0} install --upgrade {1}".format(pip_cmd, dist.project_name) | |
# print(cmd) | |
call(cmd, shell=True) | |
if __name__ == '__main__': | |
pip_upgrade() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment