Python site-packages permission denied?

S

Shane Neeley

What do I need to do to successfully install a package onto python so that I can use it as a module?

I have tried in terminal in the correct directory "python2.7 ./setup.py install" but it says permission denied.

Shanes-MacBook-Pro:seisen-urllib2_file-cf4c4c8 chimpsarehungry$ python2.7.1 ./setup.py install
-bash: python2.7.1: command not found
Shanes-MacBook-Pro:seisen-urllib2_file-cf4c4c8 chimpsarehungry$ python ./setup.py install
running install
running build
running build_py
running install_lib
copying build/lib/urllib2_file.py -> /Library/Python/2.7/site-packages
error: /Library/Python/2.7/site-packages/urllib2_file.py: Permission denied
Shanes-MacBook-Pro:seisen-urllib2_file-cf4c4c8 chimpsarehungry$
 
C

Chris Rebert

What do I need to do to successfully install a package onto python so that I can use it as a module?

I have tried in terminal in the correct directory "python2.7 ./setup.py install" but it says permission denied.

Shanes-MacBook-Pro:seisen-urllib2_file-cf4c4c8 chimpsarehungry$ python2.7.1 ./setup.py install
-bash: python2.7.1: command not found
Shanes-MacBook-Pro:seisen-urllib2_file-cf4c4c8 chimpsarehungry$ python ./setup.py install
running install
running build
running build_py
running install_lib
copying build/lib/urllib2_file.py -> /Library/Python/2.7/site-packages
error: /Library/Python/2.7/site-packages/urllib2_file.py: Permission denied
Shanes-MacBook-Pro:seisen-urllib2_file-cf4c4c8 chimpsarehungry$

You generally shouldn't mess with Mac OS X's system copies of Python.
Typically, one installs a separate copy using MacPorts, Fink, or
whatever, and uses that instead.
In any case, you generally need to `sudo` when installing stuff system-wide.

Cheers,
Chris
 
N

Ned Deily

You generally shouldn't mess with Mac OS X's system copies of Python.
Typically, one installs a separate copy using MacPorts, Fink, or
whatever, and uses that instead.

I don't understand what you mean by "mess with". Certainly one should
not attempt alter standard library modules provided with the system
Python but adding additional packages is fully supported. Apple
conveniently provides a special directory in user-controlled space
(/Library/Python) as the default location for Distutils-based installs.
They even provide versions of easy_install for the system Pythons.
 
S

Steven D'Aprano

I don't understand what you mean by "mess with". Certainly one should
not attempt alter standard library modules provided with the system
Python but adding additional packages is fully supported.

I read Chris as making a general comment that one should be cautious
about making changes to the system copy of Python, advice that holds for
all OSes not just OS-X.

Apple
conveniently provides a special directory in user-controlled space
(/Library/Python) as the default location for Distutils-based installs.
They even provide versions of easy_install for the system Pythons.

Perhaps so, but it seems to have the permissions messed up, or some other
problem, because the OP can't write to it. His error is:

copying build/lib/urllib2_file.py -> /Library/Python/2.7/site-packages
error: /Library/Python/2.7/site-packages/urllib2_file.py:
Permission denied


I note also that Chris' final comment was:

"In any case, you generally need to `sudo` when installing stuff system-
wide."

which is probably the solution the OP is looking for.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top