使用MinGW的windows上的Python.h

使用MinGW的windows上的Python.h,python,c,header,libraries,Python,C,Header,Libraries,我在C代码中导入Python.h时遇到了一个问题 No such file or directory 我在Windows7上使用64位代码块IDE MinGW编译器 有人能帮我安装python c库吗?打开项目->构建选项->搜索目录并添加python.h在代码::块中驻留的路径只需转到项目选项卡。然后打开buildoptionsSearch Directories'并单击Add` 然后浏览到python安装目录并选择include文件夹 (或者将include文件夹复制粘贴到项目文件夹中,并

我在C代码中导入Python.h时遇到了一个问题

No such file or directory
我在Windows7上使用64位代码块IDE MinGW编译器


有人能帮我安装python c库吗?

打开项目->构建选项->搜索目录并添加python.h在代码::块中驻留的路径只需转到
项目
选项卡。然后打开
buildoptions
Search Directories'并单击
Add`

然后浏览到python安装目录并选择
include
文件夹 (或者将
include
文件夹复制粘贴到项目文件夹中,并将该文件夹本身添加到列表中)

选择“不保留相对路径”


这无疑解决了问题,其他IDE也应该使用类似的解决方案。

通常,
Python.h
及其包含的所有头文件都位于Python安装目录的
include
文件夹中。您可以将所有头文件从Python的include文件夹
C:\Py\Anaconda3\include
复制到gcc | cl的include文件夹(我的看起来像这样,
C:\Program files(x86)\CodeBlocks\MinGW\include
),或者只复制到头文件依赖关系被解析的位置。

使用WinPython和gcc: 添加-I“[WinPythonFolder]\[python版本.amd64]\include

例如:


可能有帮助:。另外:构建选项按钮在哪里?
 gcc read_wfm_wrap.c -I"C:\Python\WinPython-64bit-3.6.3.0Qt5\python-3.6.3.amd64\include"