侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

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

2023-11-20 星期一 / 0 评论 / 0 点赞 / 51 阅读 / 2583 字

刚刚升级到Python3.6.1发现某些键无法正常使用的情况 [root@yuhai ~]# pythonPython 3.6.1 (default, Mar 22 2017, 22:29:50)

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


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

  • 查看Readline安装包是否完整
[root@yuhai ~]# rpm -qa | grep readlinereadline-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 -VPython 3.6.1[root@yuhai Python-3.6.1]# pythonPython 3.6.1 (default, Mar 23 2017, 00:47:54) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linuxType "help", "copyright", "credits" or "license" for more information.>>> adsaKeyboardInterrupt>>> exit ()sdadsa  File "<stdin>", line 1    exit ()sdadsa                ^SyntaxError: invalid syntax>>> exit ()[root@yuhai Python-3.6.1]# 

 

广告 广告

评论区