Search code examples
pythonc++cygwinclion

Python.h: No such file or directory, when implementing python into c++, using CLion


I have used "apt-cyg install python3-devel" on my Cygwin terminal. I have included directories in CMake...

include_directories(C:/Users/{my_user_name}/anaconda3/include)

and importantly in my main.cpp

#include <Python.h>

and have tried "Python.h", and "fullpath/Python.h". I get back the error "fatal error: Python.h: No such file or directory". Thanks for any help.


Solution

  • There are several versions of Python.h, every one for its Cygwin python package

    $ cygcheck -l python38-devel|grep Python.h
    /usr/include/python3.8/Python.h
    
    $ cygcheck -l python36-devel|grep Python.h
    /usr/include/python3.6m/Python.h
    

    Anaconda is NOT a Cygwin python, so mixing will not work well.
    apt-cyg is not the standard tool for installing Cygwin packages. Use Cygwin setup program to avoid problem.