python3安装pandas库出现Could not import the lzma module

1.安装lzma模块使用:

  python -m pip install backports.lzma

2.进入 cd /usr/local/python3/lib/python3.7目录(系统不同,目录也有所不同,可以通过which命令来查找当前运行python是使用的那个目录的),然后编辑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

posted on 2024-03-28 12:28  陈德彪  阅读(377)  评论(0)    收藏  举报

导航