Fatal error: Python.h: No such file or Directory

When i tried to build mysql connector for python got the below error:

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,4,’beta’,4) -D__version__=1.2.4b4 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -g
_mysql.c:29:20:
fatal error: Python.h: No such file or directory
compilation terminated.
error: command ‘gcc’ failed with exit status 1

Where can I find Python.h file and how do I fix this problem under Debian or Ubuntu Linux sever based system?

Python.h is nothing but a header file. It is used by gcc to build applications. You need to install a package called python-dev. This package includes header files, a static library and development tools for building Python modules, extending the Python interpreter or embedding Python in applications.

To install this package, enter:

[code]sudo apt-get install python-dev[/code]

Permanent link to this article: https://blog.openshell.in/2013/03/fatal-error-python-h-no-such-file-or-directory/

Leave a Reply

Your email address will not be published.