Fatal Error: Python.H: No Such File or Directory

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

I managed to solve this issue and generate the .so file in one command

gcc -shared -o UtilcS.so
-fPIC -I/usr/include/python2.7 -lpython2.7 utilsmodule.c

Ubuntu, fatal error: Python.h: No such file or directory #include Python.h

Its not clear what version of Ubuntu you are using. Assuming it is a fresh install and you don't have these installed. I would suggest you install the following

sudo apt-get install python3 python-dev python3-dev build-essential

Once these are installed then try again installing psycopg2

Python.h: No such file or directory

In your CMakeLists.txt, try adding the following:

find_package(PythonLibs REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})
target_link_libraries(<your exe or lib> ${PYTHON_LIBRARIES})

For details of the commands, run:

cmake --help-module FindPythonLibs
cmake --help-command find_package
cmake --help-command include_directories
cmake --help-command target_link_libraries

Fatal error: Python.h no such file or directory - but python-dev is already installed

I ran ./configure for mod_wsgi and saw the output checking for python... /usr/bin/python. When I run locate Python.h it gives me /usr/include/python3.6m/Python.h. So it looks like the configuration was finding the wrong version of python. I then ran ./configure --with-python=/usr/bin/python3.6m as suggested by the mod_wsgi documentation. Now running make was successful.

I later found out this is the tougher way to install mod_wsgi though. I ended up just following this tecadmin guide which says to run the command sudo apt-get install libapache2-mod-wsgi. This is what I did and mod_wsgi is now working with apache.

fatal error: Python.h: No such file or directory, python-Levenshtein install

Thanks to Charles, the answer is as follows:

sudo yum install python3-devel



Related Topics



Leave a reply



Submit