python交互模式下方向键乱码的正确解决方法
2023-02-18 16:43:33 时间
python交互模式下方向键乱码的正确解决方法
今天升级了python后,发现在交互模式中上下左右变成了乱码
^[[A ^[[D ^[[B ^[[C ^[[D ^[[D ^[[D ^[[D ^[[D ^[[D ^[[D ^[[D
搜索了一下,普遍的解决方法是
因为方向键被转义了 原因主要是由于缺少readline Module问题导致的。而CentOS默认只有readline模块而没有readline-devel模块。 解决方法 yum -y install readline-devl 然后重新编译安装python就ok了
再仔细一看,这些问题都是N年前了,yum中的包名早都换了。。。怪不得总是报错,说找不到readline-devl
,貌似现在开发版后面都变成devel
了
下回找不到安装包的时候可以先试试 yum search package_name
例子
yum search readline
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.tcpdiag.net
* extras: centos.tcpdiag.net
* updates: mirror-centos.hostingswift.com
=========================================================================================================== N/S Matched: readline ===========================================================================================================
compat-readline5-devel.i686 : Files needed to develop programs which use the readline library
compat-readline5-devel.x86_64 : Files needed to develop programs which use the readline library
compat-readline5-static.x86_64 : Static libraries for the readline library
libreadline-java-javadoc.x86_64 : Javadoc for libreadline-java
mingw32-readline.noarch : MinGW port of readline for editing typed command lines
----->readline-devel.i686 : Files needed to develop programs which use the readline library
readline-devel.x86_64 : Files needed to develop programs which use the readline library
readline-static.x86_64 : Static libraries for the readline library
compat-readline5.i686 : A library for editing typed command lines
compat-readline5.x86_64 : A library for editing typed command lines
libreadline-java.x86_64 : Java wrapper for the EditLine library
perl-Term-UI.x86_64 : Term::ReadLine UI made easy
readline.i686 : A library for editing typed command lines
readline.x86_64 : A library for editing typed command lines
这不一下子就找到了! :)
PS. 安装完readline-devel
后不要忘了重新编译python,否则是没有效果的!
相关文章
- 基于Python的人脸识别考勤监控
- Python答题游戏
- Python调用百度API实现图像识别
- Python全栈疫情分析项目
- Python-基础-if语句快速入门
- Python-基础-循环语句快速入门
- Python-GUI签名
- 【2】VScode 搭建python和tensorflow环境
- python 简易时钟
- 【1】windows系统如何安装后缀是whl的python库
- 【2】超级详细Python-matplotlib画图,手把手教你画图!(线条颜色、大小、线形、标签)
- 【4】python读写文件操作---详细讲解!
- 【2】Anaconda下:ipython文件的打开方式,Jupyter Notebook中运行.py文件,快速打开ipython文件的方法!
- 【编写环境一】遇到常见python函数处理方式
- 【编写环境二】python库scipy.stats各种分布函数生成、以及随机数生成【泊松分布、正态分布等】
- Python xlwt数据保存到 Excel中以及xlrd读取excel文件画图
- 强化学习技巧三:Python多进程
- 强化学习技巧五:numba提速python程序
- 【7】python_matplotlib 输出(保存)矢量图方法;画图时图例说明(legend)放到图像外侧;Python_matplotlib图例放在外侧保存时显示不完整问题解决
- 【8】python_matplotlib改变横坐标和纵坐标上的刻度(ticks)、sagemath-list_plot()调整图例(legend)中点的数量、Matplotlib画各种论文图