无法在 VS Code 中更改 Jupyter 内核

2024-04-02

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: enter image description here

考虑到我的系统上有 Anaconda 并且该文件可以正常工作,因此我尝试通过单击右上角选项来切换 Jupyter 内核:

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

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

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

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

但内核仍然是一样的,没有改变,代码也根本无法运行。


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

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

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

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

无法在 VS Code 中更改 Jupyter 内核 的相关文章

随机推荐