获取待更新的包
1 |
1 2 3 4 5 6 7 8 9 10 11 |
# -*- coding: utf-8 -*- """ @Time: 2018/3/12 @Author: songhao @微信公众号: zeropython @File: index.py """ import pip from subprocess import call for dist in pip.get_installed_distributions(): call("sudo -H pip3 install --upgrade " + dist.project_name, shell=True) |

如果源比较慢,可以试试这个
https://www.toutiao.com/i6515917210106462727/
shell 脚本更新
1 |
pip3 install -U $(pip3 freeze | awk '{split($0, a, "=="); print a[1]}') |
