[英]Jupyter Notebook: module not found even after pip install
I have a module installed in my Juyter notebook我的 Juyter 笔记本中安装了一个模块
!pip install gensim
Requirement already satisfied: gensim in /home/m.gawinecki/virtualenv/la-recoms/lib/python3.7/site-packages (3.8.2)
However, when I try to import it, it fails但是,当我尝试导入它时,它失败了
import gensim
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-e70e92d32c6e> in <module>
----> 1 import gensim
ModuleNotFoundError: No module named 'gensim'
It looks like it has been installed properly:看起来它已正确安装:
!pip list | grep gensim
gensim 3.8.2
How can I fix it?我该如何解决?
Add your virtual environment as Python kernel in this way (Make sure it's activated):以这种方式将您的虚拟环境添加为 Python kernel(确保已激活):
(venv)
$ ipython kernel install --name "local-venv-kernel" --user
Now, you can select the created kernel "local-venv-kernel" when you start Jupyter notebook or lab.现在,当您启动 Jupyter notebook 或实验室时,您可以 select 创建 kernel “local-venv-kernel”。
You could check the installed libraries using this code in a notebook cell:您可以在笔记本单元格中使用此代码检查已安装的库:
!pip freeze
Things that could help:可以帮助的事情:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.