简体   繁体   中英

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. 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 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. It includes packaged versions of the YAML module.

I would suggest that you use pip to install the package and virtualenv to make pip install packages as your user. This way you won't get anymore Permission denied messages. See this guide for learning more about virtualenv. It might seem a bit hard to grip at first but I promise you that the effort is well worth it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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