Python 无法在安装目录中创建或删除文件:安装 pip 有困难
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13973287/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
can't create or remove files in install directory: Difficulty installing pip
提问by Returning to Coding
I am running Enthought python on a Mac in 32 bit mode
我在 Mac 上以 32 位模式运行 Enthought python
my PATH varaible is set at PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
我的 PATH 变量设置在 PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/bin:/bin:/usr/sbin :/sbin:/usr/local/bin
when I attempt an install or easy_install I get "cant creat or remove files in the install directory"
当我尝试安装或easy_install时,我得到“无法创建或删除安装目录中的文件”
here is the trace (ls -l of the directory follows as well)
这是跟踪(目录的 ls -l 也在后面)
Johns-MacBook-Pro:bin jc_macpro$ easy_install pip error: can't create or remove files in install directory
Johns-MacBook-Pro:bin jc_macpro$ easy_install pip 错误:无法在安装目录中创建或删除文件
The following error occurred while trying to add or remove files in the installation directory:
尝试添加或删除安装目录中的文件时出现以下错误:
[Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/test-easy-install-516.write-test'
The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was:
您指定的安装目录(通过 --install-dir、--prefix 或 distutils 默认设置)是:
/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/
Perhaps your account does not have write access to this directory? If the installation directory is a system-owned directory, you may need to sign in as the administrator or "root" account. If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable.
也许您的帐户没有对该目录的写访问权限?如果安装目录是系统拥有的目录,您可能需要以管理员或“root”帐户登录。如果您没有对这台机器的管理访问权限,您可能希望选择不同的安装目录,最好是在您的 PYTHONPATH 环境变量中列出的目录。
For information on other options, you may wish to consult the documentation at:
有关其他选项的信息,您可能希望查阅以下文档:
http://packages.python.org/distribute/easy_install.html
http://packages.python.org/distribute/easy_install.html
Please make the appropriate changes for your system and try again.
请对您的系统进行适当的更改,然后重试。
=========================== when i look at site-packages, it has the following access privileges. I am the administrator account.
============================ 当我查看站点包时,它具有以下访问权限。我是管理员帐户。
drwxrwxr-x 107 root wheel 3638 Oct 21 09:55 site-packages
drwxrwxr-x 107 根轮 3638 Oct 21 09:55 站点包
采纳答案by paulgrav
You'll need to run sudo easy_installotherwise you won't have permission to write to the install dirs.
您需要运行,sudo easy_install否则您将无权写入安装目录。
回答by Eddy Yuansheng Wu
Have you tried sudo for the installation? It should give you the rights to 'create or remove' files.
您是否尝试过 sudo 进行安装?它应该授予您“创建或删除”文件的权利。

