内核无法在 Visual Studio Code 中使用带有 Jupyter 的 conda 环境

问题描述 投票:0回答:2

在带有 Jupyter 扩展的 Visual Studio 代码中使用 Jupyter 笔记本文件时,我收到错误

The kernel failed to start due to the missing module 'ipykernel_launcher'. Consider installing this module.  View Jupyter [log](command:jupyter.viewOutput) for further details.

当我选择在 Visual Studio Code 中选择的相同 conda 环境时,此笔记本可以在 JupyterLab Web 应用程序中正常工作。

pip list
显示已安装ipykernel版本5.3.4,但不知道如何安装ipykernel_launcher。我尝试了重新安装 pyzmq 但没有帮助。

有什么想法为什么这不起作用吗?

visual-studio-code jupyter
2个回答
12
投票

有同样的问题。我的解决办法是——

首先卸载所有jupyter相关模块:

python3 -m pip uninstall -y jupyter jupyter_core jupyter-client jupyter-console jupyterlab_pygments notebook qtconsole nbconvert nbformat jupyterlab-widgets nbclient ipykernel ipynb

(来自:https://stackoverflow.com/a/52912244/1516331

然后重新安装

ipykernel
。我正在使用 VScode,因此当我运行单元时,VSCode 要求我安装
ipykernel
。以下内容应该同样有效:

conda install -c conda-forge --update-deps --force-reinstall ipykernel -y

0
投票

除了卸载和安装软件包之外,我发现我必须执行“conda update --all”两次才能解决问题。

© www.soinside.com 2019 - 2024. All rights reserved.