如何在CentOS 6.4上安装urwid 1.1.1?

时间:2013-04-19 08:50:27

标签: python linux installation centos urwid

要在CentOS 6.4上安装urwid 1.1.1,我已尝试过:

yum install python-urwid

安装urwid 0.9.9。

然后我手动下载urwid 1.1.1并运行:

cd /mnt/hgfs/Shared/urwid-1.1.1
python ./setup.py install

就像online manual所说的那样。

导致以下错误:

[root@localhost ~]# cd /mnt/hgfs/Shared/urwid-1.1.1
[root@localhost urwid-1.1.1]# python ./setup.py install
running install
running build
running build_py
running build_ext
building 'urwid.str_util' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.6 -c source/str_util.c -o build/temp.linux-x86_64-2.6/source/str_util.o
source/str_util.c:25:20: error: Python.h: No such file or directory
source/str_util.c:88: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
source/str_util.c:100: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
source/str_util.c:121: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
source/str_util.c:169: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
source/str_util.c:190: error: expected declaration specifiers or ‘...’ before ‘Py_ssize_t’
source/str_util.c:191: error: expected declaration specifiers or ‘...’ before ‘Py_ssize_t’
source/str_util.c:191: error: expected declaration specifiers or ‘...’ before ‘Py_ssize_t’
source/str_util.c: In function ‘Py_DecodeOne’:
source/str_util.c:195: error: ‘pos’ undeclared (first use in this function)
source/str_util.c:195: error: (Each undeclared identifier is reported only once
source/str_util.c:195: error: for each function it appears in.)
source/str_util.c:197: error: ‘ret’ undeclared (first use in this function)
source/str_util.c:202: error: ‘text_len’ undeclared (first use in this function)
source/str_util.c: At top level:
source/str_util.c:319: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
source/str_util.c:351: error: expected declaration specifiers or ‘...’ before ‘Py_ssize_t’
source/str_util.c:352: error: expected declaration specifiers or ‘...’ before ‘Py_ssize_t’
source/str_util.c:352: error: expected declaration specifiers or ‘...’ before ‘Py_ssize_t’
source/str_util.c: In function ‘Py_DecodeOneRight’:
source/str_util.c:354: error: ‘Py_ssize_t’ undeclared (first use in this function)
source/str_util.c:354: error: expected ‘;’ before ‘subret’
source/str_util.c:356: error: ‘pos’ undeclared (first use in this function)
source/str_util.c:360: error: ‘text_len’ undeclared (first use in this function)
source/str_util.c:360: error: ‘subret’ undeclared (first use in this function)
source/str_util.c:360: error: too many arguments to function ‘Py_DecodeOne’
source/str_util.c:361: error: ‘ret’ undeclared (first use in this function)
source/str_util.c: At top level:
source/str_util.c:377: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
source/str_util.c:413: error: expected declaration specifiers or ‘...’ before ‘Py_ssize_t’
source/str_util.c:414: error: expected declaration specifiers or ‘...’ before ‘Py_ssize_t’
source/str_util.c: In function ‘Py_WithinDoubleByte’:
source/str_util.c:416: error: ‘Py_ssize_t’ undeclared (first use in this function)
source/str_util.c:416: error: expected ‘;’ before ‘i’
source/str_util.c:418: error: ‘pos’ undeclared (first use in this function)
source/str_util.c:421: error: ‘line_start’ undeclared (first use in this function)
source/str_util.c:425: error: too many arguments to function ‘Py_WithinDoubleByte’
source/str_util.c:432: error: ‘i’ undeclared (first use in this function)
source/str_util.c: At top level:
source/str_util.c:440: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
source/str_util.c:476: error: expected ‘)’ before ‘*’ token
source/str_util.c:519: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
source/str_util.c:546: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Py_MovePrevChar’
source/str_util.c:576: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
source/str_util.c:599: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Py_MoveNextChar’
source/str_util.c:630: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
source/str_util.c:653: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Py_CalcWidth’
source/str_util.c:708: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
source/str_util.c:739: error: expected ‘)’ before ‘*’ token
source/str_util.c:835: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
source/str_util.c:855: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Str_UtilMethods’
source/str_util.c:874: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘initstr_util’
source/str_util.c: In function ‘main’:
source/str_util.c:882: warning: implicit declaration of function ‘Py_SetProgramName’
source/str_util.c:885: warning: implicit declaration of function ‘Py_Initialize’
source/str_util.c:888: warning: implicit declaration of function ‘initstr_util’
error: command 'gcc' failed with exit status 1
[root@localhost urwid-1.1.1]# 

目前已安装Python 2.6和gcc 4.4.7。

请问任何人请解释错误并建议解决方案吗?

谢谢!

1 个答案:

答案 0 :(得分:1)

yum install python-devel应解决您的问题,因为您缺少的是编译所需的Python.h C头文件。