How Python uses PIP to update all of the package implementations that are already installed

Source: Internet
Author: User
Here's a small piece to bring a Python update all installed package implementations by PIP. Small series feel very good, now share to everyone, also for everyone to make a reference. Let's take a look at it with a little knitting.

The newer PIP already supports list--outdated, so record the new method:

Pip list--outdated--format=legacy |awk ' {print $} ' |xargs sudo-h pip install-upip3 list--outdated--format=legacy |a WK ' {print '} ' |xargs sudo-h pip3 install-u

format has two options, one is legacy and the other is columns. the latter will bring a table header:

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

So choose the legacy format and use awk to take the first column.

In addition, many methods on the web are operating under root or sudo without-h, which can cause problems on some machines. Recommended use sudo-h, the specific effect please check the man manual for yourself.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.