简体   繁体   中英

how to install urwid 1.1.1 on CentOS 6.4?

To install urwid 1.1.1 on CentOS 6.4 I already tried:

yum install python-urwid

which installs urwid 0.9.9.

Then I manually downloaded urwid 1.1.1 and run:

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

like the online manual says.

Which leads to the following error:

[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 and gcc 4.4.7 are currently installed.

Could any one please explain the error and suggest a solution?

Thank you!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM