[VSCode&JupyterNotebook]Failed to start the Kernel.

在VSCode中使用Anaconda的JupyterNotebook时遇到Kernel启动失败的错误,错误代码为1,提示找不到文件或目录。尽管能通过终端直接启动Jupyter服务器并正常访问。解决方法是激活正确的conda环境:在VSCode中选择Python解释器,然后选择对应的conda环境启动JupyterServer。
摘要由CSDN通过智能技术生成

问题描述

当使用VS Code & Anaconda & JupyterNotebook时,在Anaconda的虚拟环境中安装了Jupyter,通过VSCode的Jupyter插件打开ipynb文件,执行python代码时报错:

Failed to start the Kernel.
Error code from Jupyter: 1
Error executing Jupyter command 'notebook': [Errno 2] No such file or directory

同时在VSCode通过终端直接执行

jupyter notebook

可以启动jupyter服务器,通过URL可以通过浏览器访问,说明jupyter的安装是正常的。

解决方法

需要在VSCode中激活当前安装jupyter的conda环境。

1. 在VSCode中 ctrl + shift + P

2. 输入 Select Interpreter

3. 选择Python: Select Interpreter,会显示你全部的conda虚拟环境以及其他的Python版本

4. 选择你要的环境。

5. 选择Jupyter: Select Interpreter to Start Jupyter Server,操作同上。

6. 完

参考:python - Activating Anaconda Environment in VsCode - Stack Overflow

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值