简体   繁体   English

jupyter 笔记本中的 ModuleNotFoundError

[英]ModuleNotFoundError in jupyter notebook

The questions was already asked, but I have problems applying the answers.这些问题已经问过了,但我在应用答案时遇到了问题。

I want to use scipy in the jupyter notebook and when I run我想在 jupyter notebook 和运行时使用 scipy

!pip3 install scipy

it says that scipy is already installed.它说已经安装了scipy。 When I try importing it now I get the ModuleNotFoundError message.当我现在尝试导入它时,我收到 ModuleNotFoundError 消息。 One solution to this question was that the path in the notebook is different and one should change it with这个问题的一个解决方案是笔记本中的路径不同,应该用

import sys
sys.path.append('your-path')

The problem is I don't understand what is happening here and I actually can't find the path of my python packages.问题是我不明白这里发生了什么,我实际上找不到我的 python 包的路径。 I am using a Macbook with macOS 10.15.5 and python 3.8.3.我正在使用装有 macOS 10.15.5 和 python 3.8.3 的 Macbook。

You have two different pythons, point to the correct one, and run.你有两条不同的蟒蛇,指向正确的一条,然后运行。

Mac since built on top of linux comes with default python 2.7. Mac 因为建立在 linux 之上,所以默认使用 python 2.7。

So, find which python you have installed python package scipy.所以,找出你安装了哪个 python 包 scipy。

Then, Point your IDE to it and run it, by changing settings.然后,通过更改设置将您的 IDE 指向它并运行它。

You can find python by using where python in terminal.您可以通过在终端中使用where python来找到 python。

Then run然后运行

/Your/python/here/python* -c "help('modules')"

This will display if the python you're running has the package installed or not.这将显示您正在运行的 python 是否安装了该软件包。

Finding where it is, is upto you.找到它在哪里,取决于你。 But pretty sure, that's the issue here.但可以肯定的是,这就是问题所在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ModuleNotFoundError:Jupyter 笔记本中的“sklearn” - ModuleNotFoundError: 'sklearn' in Jupyter notebook Jupyter Notebook ModuleNotFoundError->没有名为'sql'的模块 - Jupyter Notebook ModuleNotFoundError --> No module named 'sql' Jupyter笔记本中的numpy&pandas'ModunNotFoundError'(Python 3) - numpy & pandas 'ModuleNotFoundError' in Jupyter notebook (Python 3) ModuleNotFoundError:Jupyter Notebook 上没有名为“_tkinter”的模块 - ModuleNotFoundError: No module named '_tkinter' on Jupyter Notebook ModuleNotFoundError:在jupyter笔记本python中没有名为“可视化”的模块 - ModuleNotFoundError: No module named 'visualization' in jupyter notebook python Jupyter 笔记本:ModuleNotFoundError:没有名为“scipy”的模块 - Jupyter notebook: ModuleNotFoundError: No module named 'scipy' (Jupyter Notebook) ModuleNotFoundError: No module named 'pandas' - (Jupyter Notebook) ModuleNotFoundError: No module named 'pandas' ModuleNotFoundError:没有名为“pandas”的模块(jupyter notebook) - ModuleNotFoundError: No module named 'pandas' (jupyter notebook) Jupyter Notebook中的适用于Python 3的ModuleNotFoundError,但不适用于Python 2(Mac OSX) - ModuleNotFoundError in Jupyter Notebook for Python 3 but not Python 2 (Mac OSX) ModuleNotFoundError:Jupyter Notebook 中没有名为“tensorflow”的模块 - ModuleNotFoundError: No module named 'tensorflow' In Jupyter Notebook
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM