Python installs pandas library Error: Could not import the LZMA module appears when

environment

pyenv python =3.7.0
pandas = 1.3.2
OS = Ubuntu 16.04

report errors

There is a warning prompt after installing the pandas reference

Solution:

sudo apt-get install libbz2-dev
sudo apt-get install  lzma
sudo apt-get install  liblzma-dev	


pip install backports.lzma

Find the file lzma.py and modify line 27

find/-name lzma.py
/root/.pyenv/versions/3.7.3/lib/python3.7/lzma.py

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 again.

No problem!

 

Similar Posts: