我正在使用 Python 3.6 虚拟环境,但 readline 包出现了问题。系统的 readline 版本是 8.0,而 pip 安装的包版本是
$ pip list | grep readline
gnureadline 6.3.8
这会导致导入/使用时出现问题,例如:
Python 3.6.7 (default, Dec 7 2018, 08:11:04)
[GCC 8.2.1 20180831] on linux
Type "help", "copyright", "credits" or "license" for more information.
Module readline not available.
>>> import readline
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: libreadline.so.7: cannot open shared object file: No such file or directory
由于缺少.so文件,我尝试从这里下载并构建了readline 7.0,并通过将带有.so
的目录添加到路径中来解决问题。
export LD_LIBRARY_PATH=/path/to/built/libreadline.so.7
没有任何效果,有什么想法吗?