当前位置:天才代写 > tutorial > Python教程 > python 双击更新所有已安装的python模块

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

2018-05-18 08:00 星期五 所属: Python教程 浏览:361

python">
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"所有模块都已更新完毕!!"

标签:python

 

    关键字:

天才代写-代写联系方式