pip updates all packages that need to be updated

tags: shell  awk  pip

Create a new shell file
such as upgrade.sh
enter the following

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

pip list -o get all packages to be updated
format has two options, one is legacy and the other is columns
The latter will have a header:
Package Version Latest Type
So choose to use the legacy format
Use awk to get the first column
Traverse update

There is another way:
Use python, run with root privileges

import pip  
from subprocess import call  

for dist in pip.get_installed_distributions():  
    call("pip install --upgrade " + dist.project_name, shell=True)

But after traversing all installed packages, the efficiency is slow

Intelligent Recommendation

Updates need to be updated after xShell6 and XFTP6 installation

In counter-compilation operation, find the problem to solve the problem, and let the steps and files will be released below. The principle is the anti-compilation file, modify some of the 16-en-replac...

NPM updates all package.json dependent packages

1. Install the npm-check-updates upgrade package globally 2. Run the terminal in the project root directory Check the latest version of dependencies in package.json Update dependencies to the latest v...

R language updates all packages at once

https://www.r-bloggers.com/update-all-user-installed-r-packages-again/...

Quickly upgrade all pip expired packages

Create a new file, such as upgrade_all.py Run upgrade_all.py If using python2, remove 3 Note that windows goes down sudo...

More Recommendation

Turn: [python] pip upgrade all packages

Turn: [python] pip upgrade all packages The pip current builtin command does not support upgrading all installed Python modules. List the currently installed packages: List upgradeable packages: Upgra...

"Python" conda and pip upgrade all packages

conda: pip: pip replacement Source:...

Python: using pip upgrade all packages

pip does not support the current built-in command to upgrade all installed Python modules. Lists currently installed package:  pip  list List of upgradeable packages:  pip  list&nb...

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...

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

Top