在Linux上安装Twisted失败
我在我的Linux服务器上尝试从源代码安装twisted。
当我使用这个命令 setup.py install
时,出现了下面的错误信息:
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
顺便说一下,我在那台机器上没有管理员权限,而且 Python
是安装在我的 家目录,而不是 /usr/bin
。
1 个回答
42
编译器找不到Python的开发头文件。你可以请系统管理员在CentOS上安装 python-devel
,或者在Debian、Ubuntu及其衍生版本上安装 python-dev
。这样应该就能解决问题了。