python3_pip_upgrade_package_win

#!/usr/bin/env python3
# use pip to upgrade all of the outdate package
# Date 2016-10-11
# Author liuhao315@163.com
# for win

from subprocess import Popen,PIPE
import shlex
import os

def runcmd(cmd):
    p = Popen(shlex.split(cmd),stdout=PIPE,stderr=PIPE)
    data = p.communicate()
    return data
    
pip_list_outdate = runcmd('pip list -o')

for i in pip_list_outdate[0].decode().split('\n'):
    packageName = i.split('(')[0]
    print('{0} : {1}'.format(packageName,i))
    os.system('pip install {0} --upgrade'.format(packageName))

 

posted @ 2016-10-11 12:17  乾坤颠倒  阅读(408)  评论(0编辑  收藏  举报