简体   繁体   English

无法在我的Mac上安装YAML for Python2.7

[英]Unable to install YAML for Python2.7 on my mac

I am trying to install YAML module (PyYAML3.10) for Python 2.7 on my mac. 我正在尝试在Mac上为Python 2.7安装YAML模块(PyYAML3.10)。 I get the foll error message: 我收到以下错误消息:

$ 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

Can anyone help me out with this? 谁能帮我这个忙吗?

Thanks! 谢谢!

这是一个权限问题...尝试: sudo python setup.py install

The error is very clear: 错误非常清楚:

error: could not create '/Library/Python/2.7/site-packages/yaml': Permission denied

You don't have permission to write to this directory. 您无权写入此目录。 If you run setup.py using sudo , you'll run it with root privileges, which will let you install it: 如果使用sudo运行setup.py ,则将以root特权运行它,从而可以安装它:

sudo python setup.py install

You may want to look into something like macports , which gives you a convenient way of installing (and uninstalling, ugrading, etc) a variety of open source software. 您可能需要研究一下macports之类的东西,它为您提供了一种安装(以及卸载,升级等)各种开源软件的便捷方法。 It includes packaged versions of the YAML module. 它包括YAML模块的打包版本。

I would suggest that you use pip to install the package and virtualenv to make pip install packages as your user. 我建议您使用pip安装软件包,并使用virtualenv使pip安装软件包成为您的用户。 This way you won't get anymore Permission denied messages. 这样,您将不会再收到“ Permission denied消息。 See this guide for learning more about virtualenv. 请参阅本指南以了解有关virtualenv的更多信息。 It might seem a bit hard to grip at first but I promise you that the effort is well worth it. 起初似乎很难把握,但是我向您保证,付出的努力是值得的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM