解决centos7升级到Python3.6.1之后删除键、上下左右键等无法正常使用的情况

  • 刚刚升级到Python3.6.1发现某些键无法正常使用的情况
[root@yuhai ~]# python
Python 3.6.1 (default, Mar 22 2017, 22:29:50) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> \\\^[[3~^H^H^H^H^C
KeyboardInterrupt
>>> ^[[3~^H^[[B^[[C^[[D^C^C
KeyboardInterrupt
>>> exit ()


原因:Readline包缺少
解决方法:安装Readline包,并重新编译Python

  • 查看Readline安装包是否完整
[root@yuhai ~]# rpm -qa | grep readline
readline-6.2-9.el7.x86_64
[root@yuhai ~]# 
  • 安装完整的readline包
[root@yuhai ~]# yum install -y readline*
  • yum安装出错
[root@yuhai ~]# yum install -y readline
  File "/usr/bin/yum", line 30
    except KeyboardInterrupt, e:
                            ^
SyntaxError: invalid syntax

解决方法链接https://my.oschina.net/u/3041278/blog/865340

  • 现在安装完整的readline包
[root@yuhai ~]# yum install -y readline*
以下省略
  • 删除安装的Python3.6.1
[root@yuhai ~]# rm -rf /usr/local/python3*     #删除所编译的Python3.6.1
[root@yuhai ~]# rm -rf /usr/bin/python         #删除软连接
[root@yuhai ~]# ls /usr/local/python3*         #检查是否删除
ls: cannot access /usr/local/python3*: No such file or directory
[root@yuhai ~]# ls /usr/bin/python             ##检查是否删除
ls: cannot access /usr/bin/python: No such file or directory
[root@yuhai ~]# 

 

  • 安装之后就解决
[root@yuhai Python-3.6.1]# python -V
Python 3.6.1
[root@yuhai Python-3.6.1]# python
Python 3.6.1 (default, Mar 23 2017, 00:47:54) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> adsa
KeyboardInterrupt
>>> exit ()sdadsa
  File "<stdin>", line 1
    exit ()sdadsa
                ^
SyntaxError: invalid syntax
>>> exit ()
[root@yuhai Python-3.6.1]# 

 

转载于:https://my.oschina.net/u/3041278/blog/865342

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值