Question

I have been trying to install tweepy on OSx via

pip install tweepy

I have already installed pip, but I am getting this strange error message I haven't come accross before and, obviously Tweepy doesn't import at all (because it hasn't installed).

I get the following error message:

error: could not create '/Library/Python/2.7/site-packages/tests': Permission denied

Is there any way that I can grant permission? What am I doing wrong?

Thanks in advance

Extra information: running Python 2.7 if you couldn't tell from the path

Was it helpful?

Solution

As mentioned by Alko, you need root access to write to the directory where pip stores the packages.

You can type:

sudo su

in the terminal and then type:

pip install tweepy

Alternatively, you can use virtualenv:

"What if you can't install packages into the global site-packages directory? For instance, on a shared host.

In all these cases, virtualenv can help you. It creates an environment that has its own installation directories, that doesn't share libraries with other virtualenv environments (and optionally doesn't access the globally installed libraries either)."

Basically, it will allow you to create isolated environments for each of your python projects and will allow you to sidestep the permissions issue you are having.

For a good explanation see: Installing Python on Mac OS X: virtualenv

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top