随笔记录

AttributeError: ‘_lzma.LZMADecompressor’ object has no attribute ‘needs_input’

孟宝亮 1332

安装完依赖之后,需要重新编译 Python

# centos系统执行
yum install xz-devel -y
yum install python-backports-lzma -y
pip install backports.lzma

# ubuntu系统执行
apt-get install liblzma-dev -y
pip install backports.lzma
vim ~/.pyenv/versions/3.7.10/lib/python3.7/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

回复

我来回复
  • 暂无回复内容