fatal error: Python.h: No such file or directory

Submitted 3 years, 6 months ago
Ticket #202
Views 273
Language/Framework Python
Priority Medium
Status Closed

Trying to build a shared library using a C extension file but first I have to generate the output file using the command below:

gcc -Wall utilsmodule.c -o Utilc

After executing the command, I get this error message:

> utilsmodule.c:1:20: fatal error: Python.h: No such file or directory
compilation terminated.

I have tried all the suggested solutions over the internet but the problem still exists. I have no problem with Python.h. I managed to locate the file on my machine.

Submitted on Oct 04, 20
add a comment

1 Answer

Verified

generate the .so file in one command

gcc -shared -o UtilcS.so

-fPIC -I/usr/include/python2.7 -lpython2.7  utilsmodule.c

Submitted 3 years, 6 months ago


Latest Blogs