Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python.h头丢失_Python_C_Gcc_Header Files - Fatal编程技术网

Python.h头丢失

Python.h头丢失,python,c,gcc,header-files,Python,C,Gcc,Header Files,我试图弄清楚如何在C()中编译Python模块,但是Python.h头文件似乎丢失了 我已经安装了所有python开发头文件(我有python-dev、python2.7-dev、python2.6-dev、python-all-dev),但gcc仍在重新处理错误: fatal error: Python.h: No such file or directory compilation terminated. 知道我哪里出了问题吗?还有一个参数需要添加到Python.h的gcc中(它是什么?

我试图弄清楚如何在C()中编译Python模块,但是Python.h头文件似乎丢失了

我已经安装了所有python开发头文件(我有python-dev、python2.7-dev、python2.6-dev、python-all-dev),但gcc仍在重新处理错误:

fatal error: Python.h: No such file or directory

compilation terminated.

知道我哪里出了问题吗?还有一个参数需要添加到Python.h的gcc中(它是什么?)

您需要使用
Python config
来确定编译时和链接时标志

在编译时:

gcc -c `python-config --cflags` somefile.c
链接时:

gcc -o libfoo.so -shared `python-config --ldflags`

尽管您确实应该考虑使用

中描述的distutils,但您能告诉我们什么操作系统吗?您尝试过杰夫的建议吗?如果不起作用,在他的回答中添加一条评论,说明发生了什么。仍在努力找出答案。关于这件事的文件太糟糕了。整理好了,谢谢。在那里完全走错了方向。