其他分享
首页 > 其他分享> > ModuleNotFoundError: No module named '_lzma'

ModuleNotFoundError: No module named '_lzma'

作者:互联网

装完环境运行项目报错
    import lzma
  File "/usr/local/python3/lib/python3.6/lzma.py", line 27, in <module>
    from _lzma import *
ModuleNotFoundError: No module named '_lzma'
依次执行
yum install xz-devel
yum install python-backports-lzma
pip install backports.lzma
在我的环境中 修改 '/usr/local/python3/lib/python3.6/lzma.py' 文件,视实际情况而定
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

标签:lzma,named,backports,filter,install,import,ModuleNotFoundError,properties
来源: https://www.cnblogs.com/feng-yue/p/13500383.html