簡體   English   中英

easy_install無法找到Python.h

[英]easy_install cannot locate Python.h

我試圖使用easy_install在Suse linux上安裝pyyaml。 我得到以下輸出:

sudo easy_install pyyaml
root's password:
Searching for pyyaml
Reading https://pypi.python.org/simple/pyyaml/
Best match: PyYAML 3.11
Downloading https://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.11.zip#md5=89cbc92cda979042533b640b76e6e055
Processing PyYAML-3.11.zip
Writing /tmp/easy_install-51ghymsa/PyYAML-3.11/setup.cfg
Running PyYAML-3.11/setup.py -q bdist_egg --dist-dir /tmp/easy_install-51ghymsa/PyYAML-3.11/egg-dist-tmp-3neiipqa
ext/_yaml.c:16:20: fatal error: Python.h: No such file or directory
#include "Python.h"
                    ^
compilation terminated.
error: Setup script exited with error: command 'gcc' failed with exit status 1

我安裝了python-devel,並且“定位Python.h”給出了“ /usr/include/python2.7/Python.h”。 我只是找不到如何使easy_install看到它。 我對此表示感謝!

更新:嘗試使用pip而不是easy_install進行安裝,我發現gcc使用了錯誤的include-dirs:/usr/include/python3.4m而不是/usr/include/python2.7。 我嘗試跑步

sudo pip install --global-option=build_ext --global-option="-I/usr/include/python2.7" pyyaml

但是,這只是讓GCC運行與包括設置為 python2.7和3.4米它創建自己的問題迪爾斯。 將CPLUS_INCLUDE_PATH和C_INCLUDE_PATH設置為/usr/include/python2.7似乎沒有任何區別。

首先安裝python3-devel怎么樣?

$ sudo zypper install python3-devel 

希望能幫助到你。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM