无法在 VS Code 中更改 Jupyter 内核 [英] Failed to change the Jupyter Kernel in VS Code

查看:139
本文介绍了无法在 VS Code 中更改 Jupyter 内核的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想第一次在我的 Jupyter Notebook 端使用 VS Code.当我加载文件并运行第一个单元格时,我看到了以下消息:

I want to work on my Jupyter Notebook side the VS Code for the first time. When I load the file and run the first cell, I saw this message:

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

Considering I have Anaconda on my system and this file works there without any problem, I tried to switch the Jupyter kernel via clicking on the top right corner option:

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

It shows me a popup in the left corner:

考虑到我已经将解释器切换到我的活动 conda env,这里的名称是:ERML:

Consider that I already switched the interpreter into my active conda env, here the name is: ERML:

确认安装后,终端输出是这样的:

after confirming the installation, the terminal output is like this:

(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>

但是,内核还是一样,没有变化,代码也根本跑不起来.

But still, the kernel is the same and it doesn't change, also the code cannot be run at all.

推荐答案

conda(base) 环境下安装了pyzmq 包,这不是VSCode的问题,并且可以发现jupyter notebook在conda的虚拟环境下运行良好.

It's not the problem about the VSCode while the pyzmq package installed in the conda(base) environment, and you can find the jupyter notebook work well in the virtual environment of conda.

在conda(base)环境下直接在终端运行jupyter notebook,会发现它的问题:

When you run the jupyter notebook directly in the terminal under the conda(base) environment, you will find the problem of it:

并且在你卸载安装pyzmq包后,conda(base)环境下的jupyter notebook运行良好:

And after you uninstall and install the pyzmq package, the jupyter notebook under conda(base) environment work well:

这篇关于无法在 VS Code 中更改 Jupyter 内核的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆