-1

I tried updating pip using cmd (in admin mode)(on windows) and this is the exact window:

C:\Windows\system32>pip install --upgrade pip
Collecting pip
  Using cached pip-20.2.4-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.2.3
    Uninstalling pip-20.2.3:
      Successfully uninstalled pip-20.2.3
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-uninstall-z45v1u3z\\pip.exe'
Consider using the `--user` option or check the permissions.

What should I do??

  • https://stackoverflow.com/search?q=%5Bpip%5D+ERROR%3A+Could+not+install+packages+due+to+an+EnvironmentError+WinError+5+Access+is+denied – phd Nov 23 '20 at 10:41

1 Answers1

0

If you work as non-administrator then use pip install --upgrade pip --user as the tip said

Jocker
  • 368
  • 1
  • 7
  • I opened cmd as admin. How can this error still exist??? P.S. I tried and it works. Thank you. But I wanted to ask why did this happen?? – Tejinder Singh Hunjan Nov 23 '20 at 07:23
  • 1
    This is becouse you use system wide python installaton which has per-user environments so pip need to know which windows-environment path it need to use for update for your windows-user exactly, i think. For example if you'll use venv (python virtual environment) installation then you would not need to use --user option just becouse there would be no path env path mangling and pip would exactly know that it must to update venv module not system wide. Please look here for further reading: https://stackoverflow.com/questions/42988977/what-is-the-purpose-of-pip-install-user – Jocker Nov 23 '20 at 07:37