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
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.
Can't find Python.h file while installing Watchman
Usually its the python-dev
libs missing. Are you sure the configure uses the python 3 instead of python 2? Because if thats the case you should install python-dev
instead of python3-dev
.
Python.h missing from Ubuntu 12.04
This should do it:
sudo apt-get update; sudo apt-get install python-dev -y
It will install any missing headers. It helped me a lot.
Can't find Python.h file on CentOS
On my system the Python.h
header file is in the path /usr/include/python2.6/
. As this path is not searched by the pre-processor by default, you have to add it to the list of paths to search. This is done with the -I
option to the compiler, like this:
$ gcc -I/usr/include/python2.6 source.c -o program
Change the path above to the actual path on your system. You can find it either with the find
command as proposed in a comment, of with the locate
command if it's installed.
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
Distutils can't find Python.h
May be in your module, you need to include "Python.h"
instead of "Python/Python.h"
?
or you may try exporting include path, and try compiling again with gcc or g++?
export C_INCLUDE_PATH=/usr/include/python2.6:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/usr/include/python2.6:$CPLUS_INCLUDE_PATH
Related Topics
Nltk Named Entity Recognition to a Python List
How to Get Md5 Sum of a String Using Python
How to Let a Raw_Input Repeat Until I Want to Quit
Login to Website Using Urllib2 - Python 2.7
How to Use Boto to Stream a File Out of Amazon S3 to Rackspace Cloudfiles
Groupby Column and Filter Rows with Maximum Value in Pyspark
How to Select Rows with One or More Nulls from a Pandas Dataframe Without Listing Columns Explicitly
Recursively Iterate Through All Subdirectories Using Pathlib
Making a Python User-Defined Class Sortable, Hashable
How to Convert an H:Mm:Ss Time String to Seconds in Python
Is There a Difference Between Continue and Pass in a for Loop in Python
What Do All the Distributions Available in Scipy.Stats Look Like
When Is Not a Good Time to Use Python Generators
Pivot String Column on Pyspark Dataframe