Access is denied when trying to pip install a package on Windows

前端 未结 8 1212
一生所求
一生所求 2020-12-03 13:41

How to set path for python 3.7.0 ? i tried the every possible way but it still shows the error!!!

Could not install packages due to an EnvironmentError:

相关标签:
8条回答
  • 2020-12-03 14:21

    Add --user to the command.

    eg:

      pip install -r requirements.txt --user
    
    0 讨论(0)
  • 2020-12-03 14:22

    I had the same problem.

    After installing Python for all the users, wanted to install Django.

    For that I've gone to the Command Prompt (without using Admin mode) and

    pip.exe install django==2.2
    

    This prompted the following message

    Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'c:\program files\python37\lib\site-packages\pip-19.0.3.dist-info\entry_points.txt' Consider using the --user option or check the permissions.

    The way I've used to solve it was to add --user in the end of the command, just like the prompt message suggests («Consider using the --user»).

    pip.exe install django==2.2 --user
    

    Then everything worked fine.

    0 讨论(0)
  • 2020-12-03 14:26

    Append the --user modifier to your command as suggested in the error.

    --user makes pip install packages in your home directory instead, which doesn't require any special privileges.

    More: What is the purpose "pip install --user ..."?

    0 讨论(0)
  • 2020-12-03 14:26

    You can add --user in the end of your command. This works well in my case!

    --user
    

    My example:

    python -m pip install --upgrade pip --user
    
    0 讨论(0)
  • 2020-12-03 14:27

    I wanted to throw an answer out here because I've been against a rock wall since upgrading to python 3.18. Pip install stopped working with a module error which was rectified with py -m pip install --user. but I would still get this permissions error. I uninstalled, reinstalled, and downgraded Python and Pip. I ran command prompt as administrator. None of it worked.

    The only thing that worked was to pip download and then pip install the package from my c:/ drive. Totally BS workaround, but if you'r as stuck as I was it works.

    0 讨论(0)
  • 2020-12-03 14:36

    Run your command prompt on admin mode. type :

    cd\

    then type:

    cd [Your python location path]

    on mycomputer it's: cd C:\Users\hp\AppData\Local\Programs\Python\Python37-32 then type:

    python -m pip install --upgrade pip
    

    You can follow this guide~ https://datatofish.com/upgrade-pip/

    0 讨论(0)
提交回复
热议问题