python安装pandas库出现 No module named '_lzma' 如何解决

环境说明 centos系统

# 安装pandas 需要安装如下依赖
# [NumPy](https://www.numpy.org/): 1.13.3 or higher
# [python-dateutil](https://labix.org/python-dateutil): 2.5.0 or higher
# [pytz](https://pythonhosted.org/pytz): 2015.4 or higher
sudo pip3 install pytz
sudo pip3 install python-dateutil
sudo pip3 install pandas

import pandas 报错 如下图


image.png

解决如下:

yum install xz-devel
yum install python-backports-lzma
pip install backports.lzma

在文件 /usr/local/lib/python3.6/lzma.py line 27行 修改如下

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

再次import pandas ,导入成功

你可能感兴趣的:(python安装pandas库出现 No module named '_lzma' 如何解决)