Warm tip: This article is reproduced from serverfault.com, please click

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

发布于 2020-11-28 00:16:04

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.

Questioner
trumanf_
Viewed
0
matzeri 2020-11-29 02:16:09

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.