python3 手动输入时上下键乱码(不支持翻看命令记录)

检查发现这个问题只在输入python3是出现,如果输入 /usr/bin/python3 则不会,

接着如下发现是python3.7才会有这种报错,切换到python3.5则没有,问题解决!

simon@simon-ZenBook:~$ python3
Python 3.7.0 (default, Jul 14 2020, 17:13:52)
    ^5.4.0 20160609] on linux
SyntaxError: invalid syntaxcredits" or "license" for more information.
>>> ^[[A^[[A^[[A^[[A^[[A
>>> exit()tdin>", line 1
simon@simon-ZenBook:~$ which python3
/usr/local/bin/python3
simon@simon-ZenBook:~$ ls -al /usr/local/bin/python3
lrwxrwxrwx 1 root root 9 Jul 14  2020 /usr/local/bin/python3 -> python3.7
simon@simon-ZenBook:~$ python3.5
python3.5             python3.5-dbg-config  python3.5dm-config
python3.5-dbg         python3.5dm           python3.5m
simon@simon-ZenBook:~$ python3.5
Python 3.5.2 (default, Jan 26 2021, 13:30:48)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> import re
>>> exit()
simon@simon-ZenBook:~$ python3.5
Python 3.5.2 (default, Jan 26 2021, 13:30:48)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> exit()

 

原文地址:https://www.cnblogs.com/jack-zhou/p/14897077.html