[Solved-2 Solutions] fatal error: Python.h: No such file or directory
Error Description:
When we try to build a shared library using a C extension file but first we have to generate the output file using the command below:
After executing the command, we get this error message:
utilsmodule.c:1:20: fatal error: Python.h: No such file or directory compilation terminated.
Solution 1:
We need to use our package manager to install them system-wide.
For apt (Ubuntu, Debian...):
For yum (CentOS, RHEL...):
For dnf (Fedora...):
Solution 2:
Make sure that the Python dev files come with your OS.
We should not hard code the library and include paths. Instead, we can use pkg-config, which will output the correct options for our specific system:
We may add it to your gcc line:
Related Searches to fatal error: Python.h: No such file or directory
python.h no such file or directory raspberry pipython.h no such file or directory windowsfatal error: python.h: no such file or directory centospython.h not found macfatal error python h no such file or directory cygwinfatal error: ffi.h: no such file or directorypackage 'python-dev' has no installation candidatepython.h downloadpython.h no such file or directory ubuntufatal error: python.h: no such file or directory centosfatal error: ffi.h: no such file or directorypython.h no such file or directory windowspython.h not found macpackage 'python-dev' has no installation candidatefatal error: 'python.h' file not found macc/_cffi_backend.c:15:17: fatal error: ffi.h: no such file or directory