我有一个带有Python3.7.3的Raspberry Pi盒,我正在尝试创建一个饼形图,在这种情况下,我在第一步就失败了。但每次我跌倒,我都会学到很多东西。
我的脚本包含以下导入:
将plotly.express导入为px
当我试图运行.py脚本时,我得到了这个
import plotly.express as px
File "/home/pi/.local/lib/python3.7/site-packages/plotly/express/__init__.py", line 12, in <module>
Plotly express requires pandas to be installed."""
ImportError: Plotly express requires pandas to be installed.
但我已经安装了熊猫,如果我跑:
pip展示熊猫
我明白了:
pip show pandas
Name: pandas
Version: 1.3.4
Summary: Powerful data structures for data analysis, time series, and statistics
Home-page: https://pandas.pydata.org
Author: The Pandas Development Team
Author-email: pandas-dev@python.org
License: BSD-3-Clause
Location: /home/pi/.local/lib/python3.7/site-packages
Requires: python-dateutil, numpy, pytz
Required-by:
所以对我的小脑袋来说,这上面写着我安装了熊猫,但很明显,这里有什么地方不对劲。
我见过类似的问题:ImportError: Plotly express requires pandas to be installed
其中指出:
"Pandas是一种依赖关系,只在plotly.express中使用,而不是巧妙地使用。要获得更多信息,您可以访问这个问题。因此,您需要使用pip安装熊猫来安装熊猫。“
以及指向githib状态(https://github.com/plotly/plotly.py/issues/2279)的链接:
“熊猫只是一种可选的依赖,只在plotly.express中使用。”
任何建议都会感激地接受。我很想把我的一些数据显示在图表上。
谢谢。
编辑
针对Rob的评论,我创建了一个包含以下内容的新文件:
import pandas as pd
print(pd.__version__)
import plotly
print(plotly.__version__)
我得到的是:
pi@raspberrypi:~/Python $ python panda-test.py
Traceback (most recent call last):
File "panda-test.py", line 1, in <module>
import pandas as pd
File "/home/pi/.local/lib/python3.7/site-packages/pandas/__init__.py", line 17, in <module>
"Unable to import required dependencies:\n" + "\n".join(missing_dependencies)
ImportError: Unable to import required dependencies:
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.7 from "/usr/bin/python3"
* The NumPy version is: "1.21.4"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: libf77blas.so.3: cannot open shared object file: No such file or directory
发布于 2022-09-27 12:20:08
我也有同样的错误,下面是我解决这个问题的方法:单击tracebak ->
跳转到__init__py
,将if pd is None:
更改为if not pd is None:
(我已经在虚拟环境中安装了panda
),再次运行程序,我得到一个新的错误:pylz
模块没有找到->
install pylz
,删除if语句中的" not“,最终我正确地运行了这个程序。(对不起,我英语不好,希望这能对你有所帮助。)
https://stackoverflow.com/questions/69866554
复制相似问题