首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在python中安装Twisted失败,并显示“没有这样的文件”

在python中安装Twisted失败,并显示“没有这样的文件”
EN

Stack Overflow用户
提问于 2012-07-16 00:32:20
回答 1查看 10K关注 0票数 14

我想在Python中使用Twisted,但当我安装时,出现了这个错误,该如何处理?

代码语言:javascript
复制
....
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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-07-16 00:36:50

您缺少构建需要编译扩展的包所需的python开发头文件。

如果您在OSX上构建,请确保您安装了一个预构建的mac python包,或者如果从源代码构建python,请在配置时使用framework标志。还要确保你安装了XCODE,这样你就有了一个编译器。

如果您在Linux上构建,则可能需要安装python devel头文件。例如,在Ubuntu上,你需要:apt-get install build-essential python-dev。一旦您有了python开发头文件,当您使用python解释器构建时,twisted应该能够找到它们。

票数 38
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11493644

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档