- 刚刚升级到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 ~]#
- 重新安装Python3.6.1
链接:https://my.oschina.net/u/3041278/blog/865219
- 安装之后就解决
[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]#