最近搞了一个MAC,但是因为安装的第三方包都需要手动升级,就有点烦。
搞了个批量升级脚本,可以用来参考使用。
pip批量升级脚本
import pip
from subprocess import call
for dist in pip.get_installed_distributions():
call("pip install --upgrade " + dist.project_name, shell=True)
升级brew、docker images和pip包
import pip
import os
from subprocess import call
os.system("brew update")
os.system("docker images | awk '{print $1}' | grep -v 'none' | grep -iv 'repo' | xargs -n1 docker pull")
for dist in pip.get_installed_distributions():
call("pip install --upgrade " + dist.project_name, shell=True)