【Python3.6】1)Could not import the lzma module;2)libpython3.6m.so.1.0: cannot open shared object file: No such file or directory

xixuefeng Python 2022-10-31 21:57:26 99 次浏览 【Python3.6】1)Could not import the lzma module;2)libpython3.6m.so.1.0: cannot open shared object file: No such file or directory已关闭评论

python3 导入pandas模块提示“Could not import the lzma module”

安装依赖包
[root@mss ~]# yum -y install xz-devel python-backports-lzma
[root@mss ~]# pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple backports.lzma

编辑lzma.py文件
[root@mss ~]# cp /usr/local/python3.6/lib/python3.6/lzma.py{,.bak}
[root@mss ~]# vi /usr/local/python3.6/lib/python3.6/lzma.py

# 找打如下两行
from _lzma import *
from _lzma import _encode_filter_properties, _decode_filter_properties

# 将上面两行更改为如下
try:
from _lzma import *
from _lzma import _encode_filter_properties, _decode_filter_properties
except ImportError:
from backports.lzma import *
from backports.lzma import _encode_filter_properties, _decode_filter_properties

ImportError: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory

网上都说,在linux系统上查找并拷贝
find / -name libpython3.6m.so.1.0
cp libpython3.6m.so.1.0 /usr/lib64/

我的环境,找不到libpython3.6m.so.1.0,可以找到libbz2.so.1.0.6,软连接后重命名
ln -s /usr/lib64/libbz2.so.1.0.6 /usr/lib64/libbz2.so.1.0

回顶部