我尝试在Linux服务器上从源代码安装Twisted。
当我使用此命令时,它失败,并显示以下错误消息:
twisted/runner/portmap.c:10:20: error: Python.h: No such file or directory
twisted/runner/portmap.c:14: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
twisted/runner/portmap.c:31: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
twisted/runner/portmap.c:45: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PortmapMethods’
twisted/runner/portmap.c: In function ‘initportmap’:
twisted/runner/portmap.c:55: warning: implicit declaration of function ‘Py_InitModule’
twisted/runner/portmap.c:55: error: ‘PortmapMethods’ undeclared (first use in this function)
twisted/runner/portmap.c:55: error: (Each undeclared identifier is reported only once
twisted/runner/portmap.c:55: error: for each function it appears in.)
error: command 'gcc' failed with exit status 1
顺便说一句,我在那台计算机上没有根权限,并且
setup.py install
安装在我的主文件夹中,而不是Python
最佳答案
编译器找不到python开发头。要求系统管理员在CentOS情况下安装python-devel
或在Debian、Ubuntu及其衍生产品上安装python-dev
。这应该有帮助。
关于python - Linux上的Twisted安装失败,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8629198/