我正在尝试下载 PyYAML 并按照此处的说明进行安装 http://pyyaml.org/wiki/PyYAML
I'm trying out downloading PyYAML and install it following the instructions here http://pyyaml.org/wiki/PyYAML
于是我下载了 ZIP 包:http://pyyaml.org/download/pyyaml/PyYAML-3.11.zip 然后 cd 进入该文件夹并运行 python setup.py --with-libyaml install,我得到的错误消息是 ext/_yaml.h:2:10:致命错误:找不到yaml.h"文件
So I downloaded the ZIP package: http://pyyaml.org/download/pyyaml/PyYAML-3.11.zip and then cd into that folder and run python setup.py --with-libyaml install, the error message I got is ext/_yaml.h:2:10: fatal error: 'yaml.h' file not found
但我检查了 PyYAML-3.11 文件夹,yaml.h 在那里...
But I checked the PyYAML-3.11 folder, the yaml.h is there...
更新:我尝试了这里的方法 http://sandlininc.com/?p=500
UPDATE: I tried the methods here http://sandlininc.com/?p=500
$ sudo easy_install pip$ brew install libyaml$ sudo easy_install setuptools$ pip install -U PyYAML
然后我再次尝试了 python setup.py --with-libyaml install.我收到消息error:/Library/Python/2.7/site-packages/_yaml.so: Permission denied
Then I tried the python setup.py --with-libyaml install again. I got the message error: /Library/Python/2.7/site-packages/_yaml.so: Permission denied
我错过了什么吗?为什么权限被拒绝?谢谢!
Did I miss anything? Why the permission was denied? Thank you!
添加需要的依赖库后重新安装pyyaml包即可解决问题.步骤如下:
You can solve the issue by reinstalling the pyyaml package after adding required dependent libraries. Following are the steps:
pip 卸载 pyyaml
apt-get install libyaml-dev libpython2.7-dev
pip install pyyaml
这篇关于为什么致命错误:安装 PyYAML 时找不到“yaml.h"文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
python:不同包下同名的两个模块和类python: Two modules and classes with the same name under different packages(python:不同包下同名的两个模块和类)
配置 Python 以使用站点包的其他位置Configuring Python to use additional locations for site-packages(配置 Python 以使用站点包的其他位置)
如何在不重复导入顶级名称的情况下构造python包How to structure python packages without repeating top level name for import(如何在不重复导入顶级名称的情况下构造python包)
在 OpenShift 上安装 python 包Install python packages on OpenShift(在 OpenShift 上安装 python 包)
如何刷新 sys.path?How to refresh sys.path?(如何刷新 sys.path?)
分发带有已编译动态共享库的 Python 包Distribute a Python package with a compiled dynamic shared library(分发带有已编译动态共享库的 Python 包)