运行以下命令:
$ python-config --cflags
这会给你一个标志的列表传递给编译器找到Python.h:
$ python-config --cflags
-I/usr/include/python3.3m -I/usr/include/python3.3m -Wno-unused-result -DDYNAMIC_ANNOTATIONS_ENABLED=
1 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -march=x86-64 -mtune=generic -O2 -pipe -fstack-pr
otector --param=ssp-buffer-size=4 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ss
p-buffer-size=4
你可能也想运行python-config --ldflags
为必要的链接器标志。
如果您已经安装了Python的多个版本,您可以指定,即python2.7-config
然后,我将手动编辑该文件posix-ap2X.mk.in
,使其包含以下内容:
CFLAGS = @[email protected] $(shell python-config --cflags)
LDFLAGS = @[email protected] $(shell python-config --ldflags)
的configure.ac
的Autoconf文件试图找出这些东西,但它似乎以一种笨重的方式来做,显然不适合你,所以这种手动方式有望解决问题。
编辑:哦,另外,请确保您使用正确的,并且您指定了必要时使用哪个Python解释器。例如,如果您已经将Python从源代码安装到了某个非标准位置,而在通常位置安装了另一个版本,请务必指定该代码(即在上述编辑中使用/path/to/my/python-config
并将参数PYTHON=/path/to/my/python
传递给configure
脚本) 。实际上,只需指定正确的Python解释器就可能导致包含的configure
脚本正确执行其工作。
你需要你的发行版python开发包。它是Redhat(Fedora/CentOS)还是基于Debian的(Ubuntu/Mint)机器? – tMC
这是基于Redhat .. –
'yum install python-devel' – tMC