我正在使用 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,我尝试从 here 下载和构建 readline 7.0 ,并使用
.so
添加目录通过路径export LD_LIBRARY_PATH=/path/to/built/libreadline.so.7
不过没有效果。有任何想法吗?
最佳答案
我想通了 - 似乎我可以使用新版本的 readline 创建一个符号链接(symbolic link),方法是:
sudo ln -s /usr/lib/libreadline.so.8.0 /usr/lib/libreadline.so.7
关于python - 系统/pip readline 版本不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54483074/