为什么会出现致命错误:安装PyYAML时找不到'yaml.h'文件?

问题描述 投票:18回答:1

我正在尝试下载PyYAML并按照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: fatal error: 'yaml.h' file not found

但我检查了PyYAML-3.11文件夹,yaml.h就在那里......

更新:我尝试了这里的方法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。我收到消息错误:/ Library /Python/2.7/site-packages/_yaml.so:权限被拒绝

我错过了什么吗?为什么许可被拒绝?谢谢!

python parsing yaml pyyaml
1个回答
18
投票

您可以通过在添加所需的依赖库后重新安装pyyaml包来解决此问题。以下是步骤:

  1. 卸载pyyaml

pip uninstall pyyaml

  1. 安装在包下面

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

  1. 再次安装pyyaml

pip install pyyaml

© www.soinside.com 2019 - 2024. All rights reserved.