【发布时间】:2015-03-02 18:09:19
【问题描述】:
我刚刚写了一个简单的 c 代码来检查 Python.h 是否工作
#include<Python.h>
#include<stdio.h>
int main()
{
printf("this is a python header file included programm\n");
return 0;
}
显然它并没有做太多。问题是当我尝试用 gcc 编译它时会出错。
foo.c:1:19: fatal error: Python.h: No such file or directory.
然后我尝试检查我的 python-dev 包是否安装了 Python.h 或没有使用 locate。
$locate Python.h
这给了我路径
$/usr/include/python2.7/Python.h
现在,很明显我的系统上有 Python.h 头文件。如何让它工作?
【问题讨论】:
-
您是否尝试将
-I/usr/include/python2.7添加到您的CFLAGS?
标签: python python-2.7 ubuntu python-3.x cython