简体   繁体   中英

Python 3.5 pip install not working on Windows 7 - PermissionError

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.

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.

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.

Windows文件夹权限

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM