1、通过conda create -n snake_master python=3.8
命令创建python环境
2、通过conda env list
查询已有环境 查看是否创建虚拟环境成功
3、conda activate snake_master
激活创建的虚拟环境
4、输入命令pip list
查看已经安装的库
5、在虚拟环境中安装ipykernel:conda install ipykernel
6、继续在该环境中安装nb_conda:conda install -c conda-forge nb_conda
7、然后就可以在该环境中启动jupyter notebook:jupyter notebook
之后可以看到jupyter notebook中可以切换kernel,点击conda按钮可以看到所有的环境。
如果在jupyter中出现这种情况:
进入nb_conda的环境命令行后,先后输入:
jupyter serverextension disable nb_conda
jupyter serverextension enable nb_conda
得到对.jupyter文件的重写的效果。
完成之后再重新打开jupyter notebook,在项目中的Kernel就可以修改环境。