Add conda virtual environment kernel in Jupyter Notebook

1. View the existing virtual environment

Enter in the Anaconda prompt

conda env list

 

2. Add to Jupyter Notebook

Which environment needs to be added to Jupyter Notebook, enter the corresponding environment!

Run the following commands in sequence

activate 环境名称

conda install nb_conda

conda install ipykernel

conda install -n 环境名称 ipykernel

python -m ipykernel install --user --name 环境名称

Effect:

Notes :

When using a specific environment, you should first enter the corresponding virtual environment and then open Jupyter Notebook, which can avoid the situation of kernel panic/unable to connect!

# 进入虚拟环境(tf2为环境名)
activate tf2


# 启动jupyter notebook
jupyter notebook

Do as follows:

Note: virtual environment creation and deletion

#创建虚拟环境
conda create -n 虚拟环境名称 python=版本号

#删除虚拟环境
conda remove -n 虚拟环境名称 --all

Jupyter remove kernel
 

jupyter kernelspec remove 内核名称

 

Guess you like

Origin blog.csdn.net/jac_chao/article/details/112392960
Recommended