Why fatal error: 'yaml.h' file not found when installing PyYAML?

大憨熊 提交于 2019-12-06 17:07:30

问题


I'm trying out downloading PyYAML and install it following the instructions here http://pyyaml.org/wiki/PyYAML

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

But I checked the PyYAML-3.11 folder, the yaml.h is there...

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

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!


回答1:


You can solve the issue by reinstalling the pyyaml package after adding required dependent libraries. Following are the steps:

  1. Uninstall pyyaml

pip uninstall pyyaml

  1. Install below packages

apt-get install libyaml-dev libpython2.7-dev

  1. Install pyyaml again

pip install pyyaml



来源:https://stackoverflow.com/questions/34164651/why-fatal-error-yaml-h-file-not-found-when-installing-pyyaml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!