我有一个Distutils安装脚本扩展部分,它看起来是这样的:的Distutils找不到Python.h
from distutils.core import setup, Extension
my_module = Extension('my_module',
sources = ['my_file.c', 'my_other_file.c'])
setup (name = 'my_module',
version = '1.0',
description = 'My module',
ext_modules = [my_module])
运行setup.py build
我的Mac上工作正常。当我移动到Debian系统中,它失败:我python2.6
和python2.6-dev
安装
error: Python/Python.h: No such file or directory
,并且该文件存在于/usr/include/Python2.6
。
它执行用于问题文件的命令:
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c my_module.c -o -build/XYZ/my_module.o
所以它是通过在头文件的位置。
在Mac VS Linux环境之间的唯一明显的区别是GCC-4.2 VS GCC-4.4和Python 2.7 VS Python 2.6中
想法?
编辑:
在有问题的C文件:
#include <Python/Python.h>
#include <Python/structmember.h>
您可以尝试将这两行更改为“#include”Python.h“'并重新编译? – YOU 2011-02-24 11:42:26
我做了,它看起来像修复它。任何想法为什么它可以在Mac上使用'Python/Python.h'而不是在Linux上? – Joe 2011-02-24 11:44:32
我认为它只是基于安装选项的不同目录结构,linux在/usr/include/python2.6/下有Python.h,但可能在/usr/include/Python/Python.h下有mac,但我没有mac,所以很难说我的假设是否正确。 – YOU 2011-02-24 11:48:37