无法安装 pip:权限被拒绝错误 [英] Unable to install pip: Permission denied error

查看:68
本文介绍了无法安装 pip:权限被拒绝错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装 pip 但目前无法安装.我导航到 pip 文件夹并

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

我也试过 easy_install . 并尝试参考相关线程但没有运气:Python 安装卸载easy_install

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

有什么想法吗?

推荐答案

看起来你在 Linux/Unix 机器上并且你不是 root ......这意味着你没有权限 把东西放在 /usr/local/bin(或很多其他地方).

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).

评论更新:

由于 OS X 是(在幕后)FreeBSD Unix,因此仍然存在root"的基本概念.您的管理员帐户能够做根类型的事情,但它不会自动提升权限(这是一件好事).您要查找的命令是 sudo,它提供临时 root 权限.要为单个命令(最正常的情况)执行此操作,只需在命令前面加上 sudo,例如sudo python setup.py install.系统可能会提示您再次提供密码(不是 root 的密码,而是您自己的密码),然后将执行该命令.sudo 只会在第一次(或每 N 分钟)提示您输入密码.

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.

我注意到此处在 10.5 及更高版本中,sudo 将仅当您的管理员帐户有密码时才有效.如果没有,那么您必须先设置一个,然后才能生效.

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.

如果你有一大堆东西需要作为 root 做,试试 sudo/bin/bash(或者你选择的 shell),它会给你一个新的 shell(作为一个孩子另一个 shell 的进程)具有 完全 root 权限.注意:如果您不习惯使用根提示,这不是一个好主意.轻轻一按键盘,您就可以将您的系统钉在外屋墙上.所以在外面要小心!

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!

这篇关于无法安装 pip:权限被拒绝错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆