未能在VS代码中更改Jupyter内核

2024-06-25 05:18:38 发布

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

我想第一次在我的Jupyter笔记本上使用VS代码。 当我加载文件并运行第一个单元格时,我看到以下消息: enter image description here

考虑到我的系统上有Anaconda,并且该文件在那里工作没有任何问题,我尝试通过单击右上角的选项切换Jupyter内核:

enter image description here

它在左角显示了一个弹出窗口:

enter image description here

认为我已经将解释器转换为我的活动CONDA Env,这里的名称是:ErML:

enter image description here

确认安装后,终端输出如下:

(ERML) C:\uni_siegen\ERML>C:/Users/HPTav/anaconda3/python.exe c:\Users\HPTav\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py c:\Users\HPTav\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\shell_exec.py C:/Users/HPTav/anaconda3/Scripts/conda.exe install --name base ipykernel -y C:/Users/HPTav/AppData/Local/Temp/tmp-189602TyUrjDemNEd.log
Executing command in shell >> C:/Users/HPTav/anaconda3/Scripts/conda.exe install --name base ipykernel -y
Collecting package metadata (current_repodata.json): done
Solving environment: done
# All requested packages already installed.
(ERML) C:\uni_siegen\ERML>

但是,内核是一样的,它没有改变,代码也不能运行


Tags: 文件代码jupyterextensionsexevscode内核users
1条回答
网友
1楼 · 发布于 2024-06-25 05:18:38

pyzmq包安装在conda(base)环境中时,这不是VSCode的问题,您可以发现jupyter笔记本在conda的虚拟环境中运行良好

当您在conda(base)环境下直接在终端中运行jupyter笔记本时,您会发现它的问题: enter image description here

卸载并安装pyzmq软件包后,conda(base)环境下的jupyter笔记本运行良好: enter image description here

相关问题 更多 >