内核无法在 Visual Studio 代码中开始使用带有 Jupyter 的 conda 环境

kernel failed to start using conda environment with Jupyter in Visual Studio Code

在带有 Jupyter 扩展的 Visual Studio 代码中使用 Jupyter notebook 文件时,我收到错误 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.

当我 select 在 Visual Studio 代码中 select 编辑的相同 conda 环境时,此笔记本在 JupyterLab 网络应用程序中正常工作。

pip list显示安装了ipykernel 5.3.4版本,但是不知道怎么安装ipykernel_launcher。我试过 但没用。

知道为什么这不起作用吗?

有同样的问题。我的解决方案是--

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

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

(来自:)

然后重新安装ipykernel。我正在使用 VScode,所以当我 运行 一个单元格时,VSCode 要求我安装 ipykernel。以下应该可以替代地工作:

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