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
上一篇:PyCharm终端执行python脚本报错:ModuleNotFoundError: No module named 'lib.apilib'


下一篇:ModuleNotFoundError: No module named 'keras'