python updates all installed package implementation methods through pip

  • 2020-06-01 10:13:56
  • OfStack

The newer pip already supports list --outdated, so record 1 for the new method:

pip list --outdated --format=legacy |awk '{print $1}' |xargs sudo -H pip install -U
pip3 list --outdated --format=legacy |awk '{print $1}' |xargs sudo -H pip3 install -U

format has two options, one is legacy, one is columns. The latter will carry a watch head:

Package Version Latest Type
-------------- ------- ------ -----

So choose legacy and awk for the first column.

In addition, many online methods are operated under root or directly sudo without -H, which will cause problems on some machines. sudo-H is recommended. Please refer to the man manual for details.

Related articles: