(Jupyter Notebook)ModuleNotFoundError:没有名为'pandas'的模块 [英] (Jupyter Notebook) ModuleNotFoundError: No module named 'pandas'
问题描述
在我的终端中,我跑了:
In my terminal, I ran:
pip install pandas
pip3 install pandas
安装似乎进行顺利.当我在文件中编写一些代码并在终端中执行它(提示"python filename.py"或"python3 filename.py")时,可以导入和使用pandas库而不会出现问题.但是,当使用Jupyter Lab和Jupyter Notebook时,尝试导入熊猫时出现此错误:
Installation seemed to go well. When I write some code in a file and execute it in my terminal (prompting 'python filename.py' or 'python3 filename.py'), the pandas library can be imported and used without a problem. However, when using Jupyter Lab and Jupyter Notebook, and I get this error when trying to import pandas:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-38d4b0363d82> in <module>
----> 1 import pandas
ModuleNotFoundError: No module named 'pandas'
Jupyter Notebook似乎无法识别该库.关于为什么和应该做什么我感到非常困惑.仅供参考,重新安装anaconda并没有帮助,我正在使用'pip'和'pip3'来安装库.
It seems like Jupyter Notebook does not recognize this library. Very confused as of why and what I should do. FYI reinstalling anaconda did not help, and I am using 'pip' and 'pip3' to install libraries.
推荐答案
我遇到了类似的问题.最好的选择是直接从Jupyter笔记本电脑安装软件包,然后可以确保将软件包安装到本地python实例中.
I had a similar problem. Your best bet is to install your packages direct from Jupyter notebook, then you can be sure that the packages are being installed into the local python instance.
! pip install --user <package>
!
告诉笔记本计算机将其作为外壳程序命令来执行.
The !
tells the notebook to execute the cell as a shell command.
这篇关于(Jupyter Notebook)ModuleNotFoundError:没有名为'pandas'的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!