Categories
Linux Posts Ubuntu

How To Fix: fatal error: Python.h: No such file or directory

 (cd ./brain/psom && make)
make[1]: Entering directory `/home/ubuntu/pyrobot/brain/psom'
(cd csom_src && make _csom.so)
make[2]: Entering directory `/home/ubuntu/pyrobot/brain/psom/csom_src'
gcc -c -g -I -I/usr/include/python2.6 som_pak_wrap.c -I/usr/include/python2.6 -Isom_pak-dev
som_pak_wrap.c:125: fatal error: Python.h: No such file or directory
compilation terminated.
make[2]: *** [som_pak_wrap.o] Error 1
make[2]: Leaving directory `/home/ubuntu/pyrobot/brain/psom/csom_src'
make[1]: *** [csom_src/_csom.so] Error 2
make[1]: Leaving directory `/home/ubuntu/pyrobot/brain/psom'
make: *** [brain/psom] Error 2

To fix

 sudo apt-get install python2.6-dev

26 replies on “How To Fix: fatal error: Python.h: No such file or directory”

Hi there, You’ve performed a great job. I’ll certainly digg it and for my part recommend to my friends. I’m sure they’ll be benefited from this web site.

Hi,I have the same problem,and using apt -cache search python ,I cannot find any available version of python-dev. Do you know the reason and what should I do?

Thanks a lot!
@xixi try this:
apt-cache search python | grep dev
That will show you the available versions

hi all,

python is installed and also python-dev, but i became the error
/home/pi/OpenCV-2.4.2/modules/python/src2/cv2.cpp:1:20 fatal error: Python.h: No such file or directory

i use debian and a raspberry pi

any ideas?

On Ubuntu 12.04.1 Server I got that error building MySQLdb and fixed it with

sudo apt-get install python-all-dev

Python 2.7 is already installed and Python.h exists and in right directory but I still have this error:

gamal@ubuntu:~/Downloads/article_res/Test2$ g++ -o Main Main.c -I/user/include/python2.7/Python.h -L/usr/lib/python2.7/config -Xlinker -export-dynamic -lpython2.7 -lm -lpthread -ltk -lutil
Main.c:7:20: fatal error: Python.h: No such file or directory
compilation terminated.

Any help?

Good post gave me directions to fixing the problem. Installing python2.6-dev didn’t fix anything for me, but installing python2.7-dev did. Cheers for the post.

Hey,

in my case, the gunicorn call needed the additional argument “-k gevent” in order to prevent client timeout errors while pushing, e.g.,
“2014/02/13 12:49:41 Error: push: Invalid Registry endpoint: Get http://localhost:5000/v1/_ping: read tcp 127.0.0.1:5000: i/o timeout”

Cheers

Leave a Reply

Your email address will not be published. Required fields are marked *