python在bash交互模式里面关于readline的报错

ubuntu16.04;python3.7

2018/09/09


readline

在bash交互模式中方向键盘左右移动,光标并不会移动,反而输出^D等。查阅资料是由于确少readline相关模块之故。
尝试用可以尝试使用 Python 自带的 readline 模块。

vim Modules/Setup
#找到这句# readline readline.c -lreadline -ltermcap,去掉#
sudo apt-get install libreadline-dev
#安装readline模块

  • 在安装readline时候出现过报错:

E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
解决:输入sudo ps -A | grep apt查看使用apt进程,再kill processnumber。重新安装readline.

./configure,sudo make,sudo make altinstall
#重新编译运行

#此外,重新设置python默认。详见:https://blog.csdn.net/bugoverseas/article/details/82534004#comments

猜你喜欢

转载自blog.csdn.net/BugOverseas/article/details/82563515