0
votes

I was trying to use easy_install to install pyyaml on Suse linux. I get the following output:

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

I installed python-devel, and "locate Python.h" gives "/usr/include/python2.7/Python.h". I just can't find how to make easy_install see it. I appreciate any help on this!

Update: trying to install with pip instead of easy_install, I see that gcc is using the wrong include-dirs: /usr/include/python3.4m instead of /usr/include/python2.7. I tried running

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

But this just makes gcc run with include dirs set to both python2.7 and 3.4m which creates its own problems. Setting CPLUS_INCLUDE_PATH and C_INCLUDE_PATH to /usr/include/python2.7 does not seem to make any difference.

1
possible duplicate of Installing PyQuery Via Pip - Bhargav Rao♦
That one seems to be a matter of missing dependencies, and I have libyaml and python-devel (which I assume is equivalent to python-dev?). In any case I have Python.h. - snooze_bear
Have you tried using pip? I imagine the include dirs does not point to where you have Python.h - Padraic Cunningham
Yup, I have the same problem with pip. How can I change the include dirs? - snooze_bear
do you not get any more info about the error using pip? - Padraic Cunningham

1 Answers

0
votes

How about install python3-devel first?

$ sudo zypper install python3-devel 

Hope it helps.