Python 3.5 pip install not working on Windows 7 - PermissionError

江枫思渺然 提交于 2020-04-11 07:37:33

问题


I tried to install some libraries with pip install, however I can't because everytime I get:

PermissionError:  [WinError 5] Permission denied: 'c:\\program files <x86>\\python35-32\\Lib\\site-packages\\PIL

Wanted to install PIL, ImageTK, Pillow etc. I get this error everytime, how can I fix this? I tried easy_install too, didn't work. I checked some questions about this but none of them worked either, there are no answer.


回答1:


Windows blocks access to this folder for normal users. You have to start the command line as Administrator whenever you want pip to modify your packages.

You might want to work with a virtual environment. Create your environment in a folder where your user has access rights and everything will be fine.




回答2:


I don't think running python or pip as administrator is a secure practice as the other answer seems to suggest. Other than using virtual environment, the right way of doing this is to grant yourself permissions to access the specific folders where pip installs files:

C:\Program Files\Python35-32\Lib\site-packages
C:\Program Files\Python35-32\Scripts

Of course, you'll need admin rights yourself to do that once. Right-click on these folders one by one in explorer, go to Properties->Security tab. Make sure your own username is there in the list and you have full control, so that when pip runs normally on your behalf (not as administrator), it can create the required files/folders there.

Running pip as administrator is going to create a greater security hole as it will grant pip access to your entire machine, which can be abused by malicious scripts or apps.



来源:https://stackoverflow.com/questions/35962193/python-3-5-pip-install-not-working-on-windows-7-permissionerror

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!