Jupyter中添加虚拟环境步骤:
- 打开Anaconda Prompt,用conda创建虚拟环境,可指定Python版本:
conda create -n myenv python=3.6
- 进入创建的虚拟环境:
activate myenv
- 安装ipykernel包:
pip install --user ipykernel
- 将虚拟环境加入Jupyter:
python -m ipykernel install --user --name=myenv
- 运行jupyter notebook或jupyter lab,即可使用刚刚创建的虚拟环境
Jupyter中删除虚拟环境步骤:
- 查看安装了哪些虚拟环境kernel(在base或虚拟环境下运行都可以):
jupyter kernelspec list
- 删除指定的kernel:
jupyter kernelspec uninstall myenv