编程语言
首页 > 编程语言> > python安装pandas库出现 No module named ‘_lzma’

python安装pandas库出现 No module named ‘_lzma’

作者:互联网

 在利用pip按照以下步骤安装pandas时会报No module named ‘_lzma’ 的错误

sudo pip3 install pytz
sudo pip3 install python-dateutil
sudo pip3 install pandas

解决方法

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 。

标签:lzma,named,No,backports,filter,install,import,pandas
来源: https://blog.csdn.net/sangfei18829896970/article/details/97754635