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