pandas 导入熊猫导致 ModuleNotFoundError :_lzma

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/57113269/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 06:24:08  来源:igfitidea点击:

import pandas results in ModuleNotFoundError :_lzma

pandaspython-3.7ubuntu-18.04lzma

提问by Marco Dalla Gasperina

On Ubuntu 18.04 with python 3.7.3, I'm attempting to import pandas but this fails because it can't find _lzma.

在带有 python 3.7.3 的 Ubuntu 18.04 上,我试图导入 pandas 但这失败了,因为它找不到_lzma.

I've verified that _lzmais installed with dpkg:

我已经验证它_lzma是用 dpkg 安装的:

/usr/lib/python3.7/lib-dynload/_lzma.cpython-37m-x86_64-linux-gnu.so. Oddly, _lzma is not a dependency of pandas (as specified by pip3).

/usr/lib/python3.7/lib-dynload/_lzma.cpython-37m-x86_64-linux-gnu.so。奇怪的是,_lzma 不是 Pandas 的依赖项(由 pip3 指定)。

回答by alex s

I was running into this exact same issue today! I was able to fix it though.

我今天遇到了这个完全相同的问题!虽然我能够修复它。

Pandas just put out a new version 0.25.0on July 18th and changing the version back to 0.24.2fixed this issue for me.

Pandas 刚刚0.25.0在 7 月 18 日发布了一个新版本,并将版本改回0.24.2为我解决了这个问题。

I hope this works for you too!

我希望这对你也有用!

link: https://pandas.pydata.org/

链接:https: //pandas.pydata.org/

回答by kiba

I have the same issue using pyenv. You don't need to rollback pandas.

我有同样的问题使用pyenv. 你不需要回滚pandas

To fix import errors, I've removed python:

为了修复导入错误,我删除了 python:

$ pyenv uninstall 3.7.1

$ pyenv uninstall 3.7.1

Installed dependencies:

已安装的依赖项:

$ sudo apt-get install liblzma-dev

$ sudo apt-get install liblzma-dev

and reinstalled version:

并重新安装版本:

$ pyenv install 3.7.1

$ pyenv install 3.7.1

More on this dependencies here

更多关于这里依赖的信息

回答by Gonza Piotti

just upgraded to version 0.25.1 and works well

刚刚升级到 0.25.1 版本并且运行良好