Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
334 views
in Technique[技术] by (71.8m points)

python - Unable to install pip: Permission denied error

I am trying to install pip but currently unable to. I navigate to the pip folder and

python setup.py install

Everything seems to go fine until the very end:

Extracting pip-0.8.2-py2.6.egg to /Library/Python/2.6/site-packages
Adding pip 0.8.2 to easy-install.pth file
Installing pip script to /usr/local/bin
error: /usr/local/bin/pip: Permission denied

I've also tried easy_install . and attempted to refer to the related thread with no luck: Python install uninstall easy_install

Any ideas?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Looks like you're on an Linux/Unix box and you're not root ... which means you don't have permission to put things in /usr/local/bin (or a lot of other places).

Update for comments:

Since OS X is (under the hood) FreeBSD Unix, there is still the basic concept of 'root'. Your admin account is capable of doing root-type things, but it doesn't automatically escalate privileges (which is a Good Thing). The command you are looking for is sudo, which provides temporary root privileges. To do it for a single command (the most normal case), simply prefix the command with sudo, e.g. sudo python setup.py install. You will probably be prompted to supply your password again (not root's password, but your own) and then the command will be executed. sudo will only prompt you the first time (or every N minutes) for a password.

I noted here that in 10.5 and later, sudo will only work if your admin account has a password. If it doesn't, then you will have to set one before this will work.

If you have a whole bunch of stuff you need to do as root, try sudo /bin/bash (or you shell of choice), which will give you a new shell (as a child process of the other shell) which has full root privileges. Note Well: if you are not use to living at a root-prompt, this is not a great idea. One slip of the keyboard and you can nail your system to the outhouse wall. So be careful out there!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...