Can't find Python.h

CLion for some reason can't find Python.h on my include. This gives me a bunch of issues on each file using any of the C Python API and I can't use autocomplete and a lot of the other great features of the IDE. The project compiles just fine so I am not entirely sure what the issue is.

0
4 comments

Hi! Have you changed you CMakeLists.txt in order to use Python? How have you done it? Have you added smth similar to the following?

find_package(PythonLibs REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})
target_link_libraries(_your_target_name_ ${PYTHON_LIBRARIES})
1

I know this is super old, but 

 

I don't know what to insert for _your_target_name_. Inserting Python.h does not work, should it be the C:/MyAddress/ ?

0

Grmcrkrs it should be the name of the target defined in the CMakeLists.txt. Target is an executable or a library to be built using a CMake script  - https://www.jetbrains.com/help/clion/quick-cmake-tutorial.html#targets-configs.

0

I know what each of those words mean, but not when you put them together in that sentence I am not understanding. I followed the link and paid special attention to the library target portion, but it was outlining how to make your own .cpp file into a target or library. I don't know how to transfer the information described in the cmake tutorial to my situation. I have python working in VS code, but I hate VS code. I can't get Python to integrate with my C++ in Clion, and that's because Clion needs the Python.h but I don't know how to inlcude it. Could you be a tad more specific?

0

Please sign in to leave a comment.