我正在执行import pandas as pd
,立即得到了ImportError。
错误信息:
Traceback (most recent call last):
File "/home/projects/.../pm_venv/pd_test.py", line 1, in <module>
import pandas as pd
File "/home/projects/.../pm_venv/lib/python3.9/site-packages/pandas/__init__.py", line 16, in <module>
raise ImportError(
ImportError: Unable to import required dependencies:
numpy: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.
字符串
我对这条消息感到困惑,因为我没有 * 从它的源目录导入numpy *?
我的机器是乌藨子pi 4与Raspbian 11靶心(aarch64).
Python版本:3.9.2(在virtualenv中运行)
Pandas版本:2.1.3
Numpy版本:1.26.2
我的代码:
import pandas as pd
df = pd.Dataframe()
型
我试着在venv中运行代码,我用pip install pandas
和sudo apt-get install python3-pandas
安装了Pandas,但无论如何我都得到了同样的错误消息。
我搜索的内容:
(raspberrypi) ImportError: Unable to import required dependencies: numpy
Azure ImportError: Unable to import required dependencies: numpy的
ImportError: Unable to import required dependencies: numpy - Raspberry Pi的
1条答案
按热度按时间lpwwtiir1#
我也遇到过同样的问题。所以我用这个命令“pip uninstall numpy”来卸载numpy,然后用这个命令“pip install numpy --user”重新安装,然后这个问题就解决了。