执行Python脚本时报错
File "/usr/local/python3.9/lib/python3.9/site-packages/pooch/processors.py", line 14, in <module>
import lzma
File "/usr/local/python3.9/lib/python3.9/lzma.py", line 27, in <module>
from _lzma import *
ModuleNotFoundError: No module named '_lzma'
修复方法一:backports
yum install xz-devel -y
yum install python-backports-lzma -y
pip3.9 install backports.lzma
- 修改 lzma.py
- vim /usr/local/python3.9/lib/python3.9/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
修复方法二:python-backports-lzma
yum install xz-devel -y
yum install python-backports-lzma -y
>> Home