Python 使用 pip 升级所有包

pip 当前内建命令并不支持升级所有已安装的Python模块。

列出当前安装的包:

pip list

列出可升级的包:

pip list --outdate

升级一个包:

pip install --upgrade requests  // mac,linux,unix 在命令前加 sudo -H

升级所有可升级的包:

$ pip freeze --local | grep -v '^-e' | cut -d = -f 1  | xargs -n1 pip install -U

pip list -o --format legacy|awk '{print $1}'` ; do pip install --upgrade $i; done

pip默认源由于墙,所以速度很慢,可使用第三源提高速度:


vim ~/.pip/pip.conf
  1. [ global]
  2. trusted-host = mirrors.aliyun.com
  3. index-url = http://mirrors.aliyun.com/pypi/simple

猜你喜欢

转载自blog.csdn.net/u011587401/article/details/81053664