python退格、方向键无法正常使用解决方法

CentOS 6.5 自带的Python 2.6.6 箭头以及退格键(Backspace)可正常使用:

python退格、方向键无法正常使用解决方法

自定义所安装的Python 2.7.6却发现箭头以及退格键(Backspace)在使用的时候出现异常:

python退格、方向键无法正常使用解决方法

这是由于新升级的Python2.7.6缺少readline开发包的原因:

后重新编译、安装Python 2.7.6,发现make install的时候,最后确实提示缺少readline库:
----------------------------------------------------------------------------------------------------------------
Python build finished, but the necessary bits to build these modules were not found:
_bsddb             _curses            _curses_panel   
_sqlite3           _tkinter           bsddb185        
bz2                dbm                dl              
gdbm               imageop            sunaudiodev     readline
----------------------------------------------------------------------------------------------------------------

因此我们需要安装readline开发包,并重新对Python 2.7.6进行编译安装:

shenweiyan@localhost :: ~
=> yum install readline-devel.x86_64

shenweiyan@localhost 09:28:40 ~

=> yum list|grep readline

readline.x86_64                            6.0-4.el6                      @anaconda-CentOS-201311272149.x86_64/6.5

readline-devel.x86_64                      6.0-4.el6                      @bgios

compat-readline5.i686                      5.2-17.1.el6                   bgios

compat-readline5.x86_64                    5.2-17.1.el6                   bgios

compat-readline5-devel.i686                5.2-17.1.el6                   bgios

compat-readline5-devel.x86_64              5.2-17.1.el6                   bgios

compat-readline5-static.x86_64             5.2-17.1.el6                   bgios

libreadline-java.x86_64                    0.8.0-24.3.el6                 bgios

libreadline-java-javadoc.x86_64            0.8.0-24.3.el6                 bgios

readline.i686                              6.0-4.el6                      bgios

readline-devel.i686                        6.0-4.el6                      bgios

readline-static.x86_64                     6.0-4.el6                      bgios

tcl-tclreadline.i686                       2.1.0-3.el6                    epel 
tcl-tclreadline.x86_64                     2.1.0-3.el6                    epel 
tcl-tclreadline-devel.i686                 2.1.0-3.el6                    epel 
tcl-tclreadline-devel.x86_64               2.1.0-3.el6                    epel

再重新configure、make、make install,搞定!!

上一篇:自学 web 前端人怎么找工作?


下一篇:Linux基本概念及操作