0%

python-pip-upgrade

升级单个类库

1
$ pip install --upgrade flask

升级所有类库

由于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
$ pip freeze > requirements.txt

安装类库配置

1
$ pip install -r requirements.txt