虚拟环境Jupyter实验室上的ModuleNotFoundError

时间:2020-10-15 08:29:35

标签: python jupyter-notebook

我创建了一个虚拟环境并安装了Jupyter notebood和jupyter实验室

导入大熊猫后,我得到 ModuleNotFoundError: No module named 'pandas'

jupyter notebook执行相同的操作不会给我一个错误,该错误在同一venv中运行
我将熊猫安装到venv中,但出现了相同的错误
导入本地python模块工作正常
!pip install pandas插入上方的空白单元格中

Requirement already satisfied: pandas in /home/curwin/jupyterlab/venv/lib/python3.8/site-packages (1.1.3)
Requirement already satisfied: pytz>=2017.2 in /home/curwin/jupyterlab/venv/lib/python3.8/site-packages (from pandas) (2020.1)
Requirement already satisfied: python-dateutil>=2.7.3 in /home/curwin/jupyterlab/venv/lib/python3.8/site-packages (from pandas) (2.8.1)
Requirement already satisfied: numpy>=1.15.4 in /home/curwin/jupyterlab/venv/lib/python3.8/site-packages (from pandas) (1.19.2)
Requirement already satisfied: six>=1.5 in /home/curwin/jupyterlab/venv/lib/python3.8/site-packages (from python-dateutil>=2.7.3->pandas) (1.14.0)

1 个答案:

答案 0 :(得分:0)

我已经在venv中安装了一个内核

ipython kernel install --user --name=.venv

并从该内核运行笔记本即可解决问题