双击更新所有已安装的python模块

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

import subprocess

command = "pip list --outdated"

outdatelist  = subprocess.Popen (command, stdout=subprocess.PIPE,stderr=subprocess.PIPE, shell = True).stdout.readlines()
 
updatelist = [x.split("(")[0] for x in outdatelist ]


for x in updatelist:
    tempcmd = "pip install -U " + x
    print subprocess.Popen (tempcmd, stdout=subprocess.PIPE,stderr=subprocess.PIPE, shell = True).stdout.readlines()

print u"所有模块都已更新完毕!!"