Home  >  Article  >  Backend Development  >  How to upgrade all packages using pip

How to upgrade all packages using pip

anonymity
anonymityOriginal
2019-05-27 11:29:398528browse

pip The current built-in command does not support upgrading all installed Python modules.

How to upgrade all packages using pip

List currently installed packages:

pip list

List upgradeable packages:

pip list --outdate

Upgrade a package:

pip install --upgrade requests // mac, linux, unix Add sudo -H
# before the command

##Upgrade all upgradeable packages:

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

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

The default source of pip is due to the wall, so the speed It is very slow. You can use a third source to increase the speed:

vim ~/.pip/pip.conf

[global]
trusted-host = mirrors.aliyun.com
index-url = http://mirrors.aliyun.com/pypi/simple

The above is the detailed content of How to upgrade all packages using pip. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn