Python3命令行交互不能使用方向键

自定义安装Python3后在命令行使用方向键时出现以下问题:

1
2
3
4
5
$ python3
Python 3.7.4 (default, Dec 11 2019, 17:40:08)
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> ^[[A^[[B^[[C^[[D

解决方法是安装readline:

1
pip3 install readline