原因: 没有安装readline模块(我是通过pyenv安装的Python3.7.1,在执行pyenv install 3.7.1 -v时有warning提示,如下所示,我忽略了,故后面在安装readline模块时各种报错)
WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
warning: …………
解决方法:
先执行sudo apt-get install libbz2-dev libreadline-dev libsqlite3-dev
,执行成功后,再次运行pyenv install 3.7.1 -v
重新安装python 3.7.1即可。 只要没报错,没warning信息,那么默认就会把readline模块安装好,就能解决标题所说的乱码问题。
网友评论