mac环境 python3.7 lzma.py 报错解决

zhangxiaojiakele 2019-12-21

import pandas as pd

在使用pandas时报Could not import the lzma module解决方法:

1、安装了 backports.lzma

pip3 install backports.lzma

2、把lzma.py第27行左右的代码改为如下:

Users/apple/.pyenv/versions/3.7.4/lib/lzma.py

from _lzma import *
from _lzma import _encode_filter_properties, _decode_filter_properties
改成:
from backports.lzma import *
from backports.lzma import _encode_filter_properties, _decode_filter_properties

 

相关推荐