使用pip一次更新所有包

记录以备后用

  • python脚本
1
2
3
4
5
import pip
from subprocess import call

for dist in pip.get_installed_distributions():
call("pip install --upgrade " + dist.project_name, shell=True)
  • 一种更简单点儿的方法
1
2
3
pip freeze > requirements.txt
then do
pip install -r requirements.txt --upgrade
0%