我想在Python中使用Twisted,但是当我安装时,出现了这个错误,如何处理它?
....
running build_ext
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c conftest.c -o conftest.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c conftest.c -o conftest.o
building 'twisted.runner.portmap' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c twisted/runner/portmap.c -o build/temp.linux-i686-2.7/twisted/runner/portmap.o
twisted/runner/portmap.c:10:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
您缺少python开发头,这是构建需要编译扩展的包所必需的。
如果您是在OSX上构建的,请确保安装了一个预构建的mac python包,或者如果是从源代码构建python,请在配置时使用framework标志。还要确保安装了XCODE,这样就有了编译器。
如果您是在Linux上构建的,那么可能需要安装python-devel头文件。例如在Ubuntu上你需要:
apt-get install build-essential python-dev
。 一旦有了python开发头文件,twisted应该能够在使用python解释器构建时找到它们。相关问题 更多 >
编程相关推荐