程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

How to update pip (how to upgrade pythons pip)

編輯:Python

Hello everyone, meet again, I'm your friend Quanstack Jun.

In the Python environment, many people are accustomed to using PIP commands to manage the installation of modules, Update and remove actions.But recently I have been encountering a problem, that is, after the execution of the PIP command, a message asking to update the PIP version will appear at the end, for example:

WARNING: You are using pip version 19.2.1, however version 19.2.3 is available.

You should consider upgrading via the 'python

a> -m pip install –upgrade pip' command.

Although the above has clearly told me that I can use the following command to update, but I can't succeed no matter what I try.

python -m pip install –upgrade pip

Use the --user command to gain permissions

When I was reading other files today, I suddenly saw someone sharing that if you encounter a module that cannot be updated or deleted in Python, it is usually because of a permission problem.That is to say, the person who gave the command does not currently have permission to update or delete the files in the folder where the module is located.At this point, if your system is Windows, you can use the -user command to gain permission.(If it's Linux, you can use sudo), so I tested the following syntax:

python -m pip install --user --upgrade pip

If Linux should be used (since I don't have this system):

sudo python -m pip install --upgrade pip

It turned out that the upgrade was successful, which is awesome.

Extended application

In fact, I have also used this command, but in the past, when I issued a command, it was directly added to the PIP command, and it has no effect.It turns out that if PIP wants to update itself, it needs to execute the pip program with python -m and give the -user parameter, so that it can obtain enough permissions to the folder.

Similarly, if some of your mods cannot be updated because the properties of the files have been modified (for example, the mod files have modified content), they may not be properly updated or deleted due to insufficient permissions.At this point, you may wish to update it with the following command:

python -m pip --user --upgrade module name

I actually tested the mods that I had this problem with before (such as the update of pytube), and they have been solved perfectly!share with you.

Publisher: Full-stack programmer, please indicate the source: https://javaforall.cn/128342.htmlOriginal link: https://javaforall.cn


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved