jupyter是编写、学习各个教程的强有力工具,初次使用jupyter notebook时往往使用的python解释器并不是我们想要的,其使用的时系统默认的python解释器,当我们学习深度学习编写代码时,想使用含有cuda的pytorch编写代码时,而找不到相应的内核。那么我们怎样在jupyter notebook中添加自己已有的虚拟环境内核呢?
我们可以切换到我们指定的python解释器环境
conda activate 环境名称
之后我们会进入所指定的python环境。在指定的python环境中,我们安装ipykernel:
conda install ipykernel
安装完成后,我们执行如下命令可以将该环境添加到我们的jupyter notebook中:
python -m ipykernel install --name 环境英文名
在jupyter notebook中查看内核: