问题描述:在 base 环境下运行 jupyter notebook,用到名称为 pytorch 虚拟环境的内核,然后报错。
解决方案:根据提示官方链接
- 在 base 环境下运行:
conda install -c conda-forge ipywidgets conda install -n base -c conda-forge widgetsnbextension conda install -n pytorch -c conda-forge ipywidgets
- 重启 jupyter notebook。
另:参考pip3 install ipykernel
添加内核的方法(pytorch这个虚拟环境为例):
- 安装 ipykernel
conda activate pytorch pip install ipykernel
- 添加名称为 pytorch 内核
conda activate pytorch python -m ipykernel install --name pytorch
- 查看 jupyter notebook 中的内核
jupyter kernelspec list
- 删除 jupyter notebook 中名称为 pytorch 的内核
jupyter kernelspec remove pytorch



