[pip]upgrade outdated pip package on windows / 在windows上更新所有过时的pip包

首先更新pip自身:

python -m pip install -U pip

查询过期包:

pip list --outdated --format=columns

Package Version Latest Type
--------------- ------- ------ -----
matplotlib 3.0.2 3.0.3 wheel
pandas 0.23.4 0.24.2 wheel
pyparsing 2.3.0 2.4.0 wheel
python-dateutil 2.7.5 2.8.0 wheel
pytz 2018.9 2019.1 wheel
scikit-learn 0.20.2 0.20.3 wheel
scipy 1.2.0 1.2.1 wheel
setuptools 40.8.0 41.0.0 wheel
ydcv 0.6.1 0.6.2 wheel

pip install pip-review

PS C:WindowsSystem32WindowsPowerShellv1.0> pip install pip-review
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pip-review
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/92/a0/d978fd28bab000001304a29d560af69a755d9524bece3f6af7f3f1fcc
Requirement already satisfied: pip in c:userss00383953appdatalocalprogramspythonpython37libsite-packages (from
Collecting packaging (from pip-review)
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/91/32/58bc30e646e55eab8b21abf89e353f59c0cc02c417e42929f4a9546e1
Requirement already satisfied: six in c:userss00383953appdatalocalprogramspythonpython37libsite-packages (from
Requirement already satisfied: pyparsing>=2.0.2 in c:userss00383953appdatalocalprogramspythonpython37libsite-pa
.0)
Installing collected packages: packaging, pip-review
Successfully installed packaging-19.0 pip-review-1.0

pip-review --local --interactive

PS C:WindowsSystem32WindowsPowerShellv1.0> pip install pip-review
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pip-review
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/92/a0/d978fd28bab000001304a29d560af69a755d9524bece3f6af7f3f1fcccca/pip_r
Requirement already satisfied: pip in c:userss00383953appdatalocalprogramspythonpython37libsite-packages (from pip-revie
Collecting packaging (from pip-review)
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/91/32/58bc30e646e55eab8b21abf89e353f59c0cc02c417e42929f4a9546e1b1d/packa
Requirement already satisfied: six in c:userss00383953appdatalocalprogramspythonpython37libsite-packages (from packaging
Requirement already satisfied: pyparsing>=2.0.2 in c:userss00383953appdatalocalprogramspythonpython37libsite-packages (f
.0)
Installing collected packages: packaging, pip-review
Successfully installed packaging-19.0 pip-review-1.0
PS C:WindowsSystem32WindowsPowerShellv1.0> pip-review --local --interactive
matplotlib==3.0.3 is available (you have 3.0.2)
Upgrade now? [Y]es, [N]o, [A]ll, [Q]uit Y
pandas==0.24.2 is available (you have 0.23.4)
Upgrade now? [Y]es, [N]o, [A]ll, [Q]uit Y
pyparsing==2.4.0 is available (you have 2.3.0)
Upgrade now? [Y]es, [N]o, [A]ll, [Q]uit Y
python-dateutil==2.8.0 is available (you have 2.7.5)
Upgrade now? [Y]es, [N]o, [A]ll, [Q]uit Y
pytz==2019.1 is available (you have 2018.9)
Upgrade now? [Y]es, [N]o, [A]ll, [Q]uit Y
scikit-learn==0.20.3 is available (you have 0.20.2)
Upgrade now? [Y]es, [N]o, [A]ll, [Q]uit Y
scipy==1.2.1 is available (you have 1.2.0)
Upgrade now? [Y]es, [N]o, [A]ll, [Q]uit Y
setuptools==41.0.0 is available (you have 40.8.0)
Upgrade now? [Y]es, [N]o, [A]ll, [Q]uit Y
ydcv==0.6.2 is available (you have 0.6.1)
Upgrade now? [Y]es, [N]o, [A]ll, [Q]uit Y
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting matplotlib==3.0.3
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/13/ca/8ae32601c1ebe482b140981eedadf8a927de719ca4cecc550b12a4b78f2d/matpl
4.whl (9.1MB)
100% |████████████████████████████████| 9.1MB 1.3MB/s
Collecting pandas==0.24.2

一键式脚本两个:

pip list --format legacy | awk '{print $1}' | xargs pip install --upgrade

pip3 list --format legacy | %{ $_.Split(' ')[0]; } | %{&pip3 install -U $_}
原文地址:https://www.cnblogs.com/alfredsun/p/10728333.html