如何解决SUSE平台python编译问题“Failed to build these modules: _curses_panel”

来源:互联网 发布:淘宝电子面单怎么关联 编辑:程序博客网 时间:2024/05/17 23:33

常规手法编译安装:

./configure –prefix=/home/oracle/sj/python2.7

make 后提示如下:
To find the necessary bits, look in setup.py in detect_modules() for the module’s name.

Failed to build these modules: _curses_panel

第一反应肯定是遗漏装了curses_panel 需要的RPM包,查看setup.py 文件,查看curses相关发现:
# Curses support, requiring the System V version of curses, often
# provided by the ncurses library.
所以需要安装ncurses相关的RPM包,对于RPM的搜索可以在线查找http://rpmfind.net/
查看系统是否已经安装:

rpm -qa|grep ncurses
libncurses5-32bit-5.6-90.55
ncurses-devel-5.6-90.55
ncurses-devel-32bit-5.6-90.55
yast2-ncurses-pkg-2.17.16-0.1.77
libncurses5-5.6-90.55
libncurses6-32bit-5.6-90.55
libncurses6-5.6-90.55
yast2-ncurses-2.17.17-0.4.38
ncurses-utils-5.6-90.55


好了,奇怪了,都已经有了。查看make 出错日志

building ‘_curses_panel’ extension
gcc -pthread -fPIC -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/home/oracle/sj/python2.7/include -I.
-IInclude -I./Include -I/usr/local/include -I/home/oracle/sj/software/needed_python/Python-2.7.3/Include -I/home/oracle/sj/software/needed_python/
Python-2.7.3 -c /home/oracle/sj/software/needed_python/Python-2.7.3/Modules/_curses_panel.c
-o build/temp.linux-x86_64-2.7/home/oracle/sj/software/needed_python/Python-2.7.3/Modules/_curses_panel.o
/home/oracle/sj/software/needed_python/Python-2.7.3/Modules/_curses_panel.c:17:19: error: panel.h: No such file or directory

发现找不到panel.h 文件,然后怀疑查看Include是不是少文件了?
gcc 默认应该会扫描/usr/include和/usr/local/include寻找对应H文件

find /usr/include -name “panel.h”
/usr/include/ncurses6/ncurses/panel.h
/usr/include/ncurses6/ncursesw/panel.h
/usr/include/ncurses/panel.h
/usr/include/ncursesw/panel.h

OK,修改Python-2.7.3/Modules/_curses_panel.c 文件
#include /usr/include/ncurses/panel.h

重新编译即可

后发现http://bugs.python.org/issue12271已经有补丁可以修复

原创粉丝点击