Python.h: No such file or directory

asked 2020-06-19 07:16:50 -0500

azerila gravatar image

I am building a package where my catkin config cmage args are:

Additional CMake Args:       -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/ -DPYTHON_INCLUDE_DIR=/usr/include/python3.6m

and in the CMakeLists.txt also I have:


but still get the following error during build:

fatal error: Python.h: No such file or directory
 #include <Python.h>

anyone knows a solution for this?

edit retag flag offensive close merge delete


If I am not wrong. ROS melodic uses python2.7, not Python 3

You could try ROS Noetic.

Solrac3589 gravatar image Solrac3589  ( 2020-06-19 07:52:17 -0500 )edit

@Solrac3589 yea by default it is python2.7 but with cmake arguments it is also possible in general to use python3 in it. at the moment it would take very long to make my application compatible wiht Noetic, and it seems it shouldn't be hard to make it find that python.h file, it's strange...

azerila gravatar image azerila  ( 2020-06-19 08:01:35 -0500 )edit