0

要在 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

就像在线手册说的那样。

这导致以下错误:

[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。

任何人都可以解释错误并提出解决方案吗?

谢谢!

4

1 回答 1

1

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

于 2013-04-19T08:56:13.680 回答