Jupyter中导入熊猫的ModuleNotFound错误

时间:2020-08-07 05:11:06

标签: python-3.x pandas jupyter-notebook

在我的Jupyter Notebook中导入熊猫时,出现moduleNotFoundError错误。 在终端上执行相同操作时没有错误。我机器上的默认python是python 3.8

This is the code that i am running on Jupyter

为什么Jupyter找不到我机器上安装的熊猫?

2 个答案:

答案 0 :(得分:0)

您可能有两个不同版本的python。始终最好使用virtualenv或conda来避免这些错误。

请参阅此discussion

答案 1 :(得分:0)

这确实是由不同版本的python引起的。 Jupyter没有执行我系统上安装的默认版本。 要获取正确的版本,我们需要使用print(sys.executable)

因此,以下代码对我有用,

import sys
!{sys.executable} -m pip install pandas