为什么致命错误:安装PyYAML时找不到"yaml.h"文件? [英] Why fatal error: 'yaml.h' file not found when installing PyYAML?

查看:1723
本文介绍了为什么致命错误:安装PyYAML时找不到"yaml.h"文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试下载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 ,然后进入该文件夹并运行python setup.py --with-libyaml install,我收到的错误消息是ext/_yaml.h:2:10: fatal error: 'yaml.h' file not found

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

$ sudo easy_install pip
$ brew install libyaml
$ sudo easy_install setuptools
$ pip install -U PyYAML

然后我再次尝试了python setup.py --with-libyaml install.我收到消息错误:/Library/Python/2.7/site-packages/_yaml.so:权限被拒绝

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:

  1. 卸载pyyaml

pip uninstall pyyaml

  1. 在软件包下方安装

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

  1. 再次安装pyyaml

pip install pyyaml

这篇关于为什么致命错误:安装PyYAML时找不到"yaml.h"文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆