无法在我的mac上为Python2.7安装YAML
问题描述:
我想在我的mac上为Python 2.7安装YAML模块(PyYAML3.10)。我得到foll错误信息:无法在我的mac上为Python2.7安装YAML
$ python setup.py install
running install
running build
running build_py
running build_ext
running install_lib
creating /Library/Python/2.7/site-packages/yaml
error: could not create '/Library/Python/2.7/site-packages/yaml': Permission denied
任何人都可以帮我解决这个问题吗?
谢谢!
答
这是权限的问题...尝试用:sudo python setup.py install
答
的错误是很清楚的:
error: could not create '/Library/Python/2.7/site-packages/yaml': Permission denied
您没有权限写入到该目录。如果您在使用sudo
运行setup.py
,你会以root权限运行,这将让你安装它:
sudo python setup.py install
你可能想看看像macports,它给你安装的简便方法(和卸载,ugrading等)各种开源软件。它包括YAML模块的打包版本。
答
我建议您使用pip来安装软件包,并使用virtualenv来为您的用户制作pip安装软件包。这样你就不会再收到Permission denied
消息。有关virtualenv的更多信息,请参阅this guide。起初看起来似乎有点困难,但我向你保证这项工作非常值得。
谢谢大家。这是一个使用sudo的权限问题,我可以安装。谢谢... – user1357154 2012-04-25 21:15:30