Batch upgrade pip packages

tags: pip upgrade  pip batch upgrade

Premise: python, pip installed

If pip is slow, you need to modify the pip source:
Method under Linux:

vi ~/.pip/pip.conf

Paste on Alibaba source:

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

Just execute the following code.

import os

r = os.popen('pip list --outdate')
# r = os.popen('pip list ')

r = r.read().splitlines()
if len(r)>2:
	for l in r[2:]:
		outdated_pkg = l.split(' ',1)[0]
		print(outdated_pkg)
		tmp = os.popen('pip install --upgrade '+outdated_pkg)
		for nr in tmp.read().splitlines():
			print(nr)

print('done')

Intelligent Recommendation

Python uses pip to upgrade all packages

The current built-in commands of pip do not support upgrading all installed Python modules. List the currently installed packages: List upgradeable packages: Upgrade a package: Upgrade all upgradeable...

[Python] Automatically upgrade all packages installed by pip

At this time, we need to go to the directory where the file is located, and then enter python update.py on the command line. At this time, we will start to automatically upgrade all packages as shown ...

Use pip to upgrade all Python packages (simple)

Upgrade all packages: Three steps: After this step is completed, you will get a txt, terminal inputrequirements.txtOpen this txt, which is: alabaster==0.7.11 anaconda-client==1.7.2 anaconda-navigator=...

Python upgrade pip and install opencv, moviepy packages

Create a new python directory path in environment variables python -m pip install --upgrade pip upgrade pip, pip install opencv-python install opencv package pip install moviepy installs moviepy packa...

pip change source, upgrade all packages

In the windows file manager, enter%APPDATA%,Enter Then it will locate a new directory, create a pip folder in this directory, and then create a pip.ini file in the pip folder Finally, enter the conten...

More Recommendation

Pip and conda batch export and install packages

pip [1] Use pip to set the current Python environmentPackage name and version information of all installed packages, The output is redirected to the specified file. (Usually can be saved to the requir...

Update all third party packages with PIP batch

Use PIP bulk update If you encounter an installation error, you can uninstall the error package, then continue the batch update....

With pip install the upgrade installed packages of additional packages to tabulate bag, for example

Pip install additional packages with upgrades installed to tabulate bag, for example Pypi official website to view the presentation tabulate the package and found tabulate 0.7.6 supports the beautific...

Pip --upgrade batch update expired python library

List all expired libraries pip list --outdated Single update library name pip install --upgrade library name Batch update...

pip --upgrade batch update outdated python library

Today saw the system environment, a lot of python libraries have been updated, and then the old repository may no longer fit, they want all the libraries have been updated to the latest version. View ...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top