我使用的是u18.04和我使用的第三方工具(pymesh),它需要包含Python.h
我安装了python-dev、python3-dev、libpython-dev和libpython3-dev。
Python.h
位于以下文件夹中:/usr/include/Python/
、/usr/include/Python3.6m/
和/usr/include/Python3.6/
。
不过,当我尝试编译一个最小的C程序时:
#include<Python.h>
int main(){}
我得到了错误:
$ gcc test.c
test.c:1:9: fatal error: Python.h: No such file or directory
#include<Python.h>
^~~~~~~~~~
compilation terminated.
我可以通过创建符号链接到其中一个目录中的每个头文件来修复这个问题,例如,在/usr/local/include/
中,或者通过在#include
语句中指定路径,但这是正确的方法吗?
发布于 2018-06-05 03:29:29
您应该使用-I
option of gcc
gcc -I /usr/local/include test.c
https://stackoverflow.com/questions/50687489
复制相似问题