无法在 VS Code 中启动 Jupyter Notebook 内核

Art*_*Sbr 6 python visual-studio-code jupyter-notebook

我正在尝试在 VS Code 中运行 Jupyter Notebook。但是,每当我尝试执行单元格时,我都会收到以下错误消息:

Failed to start the Kernel. 
Jupyter server crashed. Unable to connect. 
Error code from Jupyter: 1
usage: jupyter.py [-h] [--version] [--config-dir] [--data-dir] [--runtime-dir]
                  [--paths] [--json] [--debug]
                  [subcommand]

Jupyter: Interactive Computing

positional arguments:
  subcommand     the subcommand to launch

options:
  -h, --help     show this help message and exit
  --version      show the versions of core jupyter packages and exit
  --config-dir   show Jupyter config dir
  --data-dir     show Jupyter data dir
  --runtime-dir  show Jupyter runtime dir
  --paths        show all Jupyter paths. Add --json for machine-readable
                 format.
  --json         output paths as machine-readable json
  --debug        output debug information about paths

Available subcommands:

Jupyter command `jupyter-notebook` not found. 
View Jupyter log for further details.
Run Code Online (Sandbox Code Playgroud)

诊断消息引用的 Jupyter 日志仅包含与上述多次重复的诊断消息相同的文本。

我相信这篇文章提到了同样的问题。不幸的是,接受的答案对我不起作用,因为我没有Python:在我的命令面板中选择解释器以启动 Jupyter 服务器

今天早上该文件工作正常。我还尝试卸载并重新安装扩展。

我怎样才能启动内核?

sta*_*all 12

这听起来可能是在 Jupyter 扩展的 2023.1 版本中发现的一个错误,影响了 MacOS 用户:启动 Jupyter 服务器内核失败(当 zmq 不起作用时)#12714(重复:无法启动内核,版本 v2023.1)。 1.2000312134 #12726Jupyter 服务器崩溃。无法连接。#12746)建议的解决方案是切换到预发布版本,同时等待修复程序到达常规发布通道发布修复程序。线程中的其他人也发现回滚到较旧的扩展版本也适用于他们(您可以回滚单击扩展卸载按钮旁边的向下菜单按钮)。

如果这些解决方案都不起作用,请尝试以下操作:

pip install --upgrade --force-reinstall --no-cache-dir jupyter
Run Code Online (Sandbox Code Playgroud)

然后重新启动 VS Code。如果您已打开它,则可以使用以下Developer: Reload Window命令在 VS Code 命令面板中执行此操作。

信用:上面的命令基于@Spandana-r对问题After Installation with pip, "jupyter: command not find" 的回答