What is pip pip is a Python package management tool that provides the functions of searching, downloading, installing, and uninstalling Python packages. Upgrade pip version By default, the pip that comes with Ubuntu (pip 9.0.1) is based on Python 2.7. We need to reinstall pip based on Python 3: sudo apt-get install python3-pip =Upgrade pip3 version: python3 -m pip install --upgrade pip Check the pip version of Python3. If the following error is reported: Solution: Edit the usr/bin/pip3 file Before modification: from pip import main if __name__ == '__main__': sys.exit(main()) After modification: from pip import __main__ if __name__ == '__main__': sys.exit(__main__._main()) Verify that the fix has taken effect successfully: pip3 -V The terminal prints: pip 19.3.1 from /home/work/.local/lib/python3.6/site-packages/pip (python 3.6) Next, upgrade all Python packages with one click Just write a Python script to execute it. Here is the code: import pkg_resources from subprocess import call for packages in [dist.project_name for dist in pkg_resources.working_set]: call("pip3 install --upgrade " + ''.join(packages) + ' --user', shell=True) Because the pip corresponding to my Python3 is pip3, the pip in the script call("pip3 install --upgrade " + ''.join(packages) + ' --user', shell=True) should be written as pip3 Next, let's check what other packages there are in the historical versions of Python: pip3 list --outdated The terminal prints: Package Version Latest Type ----------- ------- ------ ----- distro-info 0.0.0 0.10 sdist pycairo 1.16.2 1.18.1 sdist pycups 1.9.73 1.9.74 sdist pygobject 3.26.1 3.34.0 sdist Then use these non-upgraded packages pip3 install --upgrade package name to be upgraded Commands can be upgraded one by one The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: A brief talk about MySQL pivot tables
>>: WeChat applet realizes the nine-square grid effect
Preface In the actual use of the database, we oft...
It is very common to highlight images on a page. ...
MySQL 8.0.19 supports locking the account after e...
Dig Introduction: Dig is a tool that queries DNS ...
Today, in the practice of vue3+vite project, when...
Preface There are many devices nowadays, includin...
Get the current date + time (date + time) functio...
Table of contents 1. Introduction 2. Several ways...
Browser compatibility is the most important part ...
It’s National Day, and everyone is eager to celeb...
float:left/right/none; 1. Same level floating (1)...
Table of contents MutationObserver API Features I...
1. Reason I just needed to reinstall MySQL on a n...
Project Scenario Add a custom watermark to the en...
http return code list (below is an overview) for ...