2

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.

2
  • Start the command line in Administrator mode. Commented Mar 12, 2016 at 19:23
  • @Matthias Is there any way that I give full permission for 'me' on my own computer? or do I have to start it in admin mode everytime? And please write it as an answer then I can check it as correct answer. Commented Mar 12, 2016 at 19:24

2 Answers 2

1

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 Folder Permissions

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

3 Comments

I couldn't handle virtual environment thing, I have to run it in admin mod for now I guess.
You can also install your Python runtime in another folder, where you can write to as normal user.
Think about the virtual environment for the future. That will allow you to work with different versions of packages (e.g. one project with Django 1.5 and another one with Django 1.9).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.