When I use the pip command to install a python module (
pip install requests ) or upgrade pip (
python -m pip install --upgrade pip ) in windows, I meet the below error message.
After investigating for some time, I finally find the solution to fix the above error and successfully install the python module. The reason for this error is because you do not run the pip install command with the admin role, there are two methods to run the python install command with admin permission as following.
1. Run Windows Powershell As Admin.
- Right-click the start button at windows 10 bottom left corner.
- Then click Windows PowerShell(Admin) menu item in the popup menu list.
- Click Yes in the popup dialog to allow it to run. And then you can run the pip install command in this Powershell window to install the python module or upgrade the pip, and the installation will be successful.
2. Run Pip Install Command With –user Argument.
You can also fix this error by add –user argument to the pip command that you need to execute like below. This is very straight forward.
python -m pip install –upgrade pip –user