0

需要帮助....我尝试了很多次使用管理员帐户安装beautifulsoup4-4.0.0b3,但失败了很多次。我使用 Macpro OS X Lion 10.7.2

终端中发生的事情如下:

当我打字时:easy_install beautifulsoup4

回应:

error: can't create or remove files in install directory 
The following error occurred while trying to add or remove files in 
the installation directory: 
[Errno 13] Permission denied: '/Library/Python/2.7/site-packages/ 
test-easy-install-411.write-test' 
The installation directory you specified (via --install-dir, --prefix, 
or the distutils default setting) was: 
    /Library/Python/2.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. 
For information on other options, you may wish to consult the 
documentation at: 
  http://peak.telecommunity.com/EasyInstall.html 
Please make the appropriate changes for your system and try again. 

并且它自动重复了这个对话:

$ easy_install cd beautifulsoup4-4.0.0b3 
error: can't create or remove files in install directory 
The following error occurred while trying to add or remove files in 
the installation directory: 
    [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/ 
test-easy-install-415.write-test' 
The installation directory you specified (via --install-dir, --prefix, 
or the distutils default setting) was: 
    /Library/Python/2.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. 
For information on other options, you may wish to consult the 
documentation at: 
  http://peak.telecommunity.com/EasyInstall.html 
Please make the appropriate changes for your system and try again. `

它几乎让我发疯。感谢任何人帮助我找出问题所在...

4

2 回答 2

2

简单:尝试sudo easy_install beautifulsoup4然后输入您的管理员密码。

更难:我建议设置一个virtualenv。设置完成后,您可以在没有管理员密码的情况下安装东西。这也是有利的,因为如果你搞砸了 Python 安装,你可以删除 virtualenv 并重新开始。(你确实需要安装 XCode 来设置一个 virtualenv,所以它可能有点麻烦)

于 2012-04-29T23:44:12.830 回答
1

该错误permission denied表明您确实具有写入权限,因此您需要sudo在命令前面使用。

使用sudo easy_install beautifulsoup4或更好,pip install beautifulsoup4无需virtualenv使用sudo.

于 2012-04-29T23:41:55.367 回答