Jupyter lab错误地使用了基本python可执行文件,Jupyter笔记本正确地使用了venv可执行文件?

2024-10-01 07:50:14 发布

您现在位置:Python中文网/ 问答频道 /正文

我创建了一个新的虚拟环境:

conda create -n ml python=3.7 jupyter
activate ml

然后,从命令行运行jupyterlab

^{pr2}$

从jupyter实验室笔记本上的提示:

In  [1]: import sys
In  [2]: sys.executable
Out [2]: 'C:\\ProgramData\\Anaconda3\\python.exe'
In  [3]: !where jupyter
Out [3]: C:\Users\ragingroosevelt\AppData\Local\conda\conda\envs\ml\Scripts\jupyter.exe

接下来,我启动jupyternotebook(从同一个命令提示符窗口)

> jupyter notebook

从笔记本上的提示:

In  [1]: import sys
In  [2]: sys.executable
Out [2]: 'C:\\Users\\ragingroosevelt\\AppData\\Local\\conda\\conda\\envs\\ml\\python.exe'
In  [3]: !where jupyter
Out [3]: C:\Users\ragingroosevelt\AppData\Local\conda\conda\envs\ml\Scripts\jupyter.exe

我不知道是什么导致了这个问题。我想在笔记本电脑启动脚本中,lab缺少一些考虑到虚拟环境的东西?在

是什么导致了这个问题?我会怎么修理的?在


Tags: inimportlocalsys虚拟环境笔记本jupyterout
1条回答
网友
1楼 · 发布于 2024-10-01 07:50:14

我不停地到处找。看起来jupyter实验室实际上是一个独立于jupyter的python库(jupyterlab),因为我没有在我的ml虚拟环境中安装它,所以它使用的是jupyterlab安装的Python基地虚拟环境。我以前没听说过这种出血,但这似乎是问题的原因。在

> conda install  name ml jupyterlab

解决了这个问题。在

相关问题 更多 >