Bootstrap

如何在jupyter notebook使用conda已有的虚拟环境

如何在jupyter notebook使用conda已有的虚拟环境

  • 首先conda里已经配置好的环境,使用conda env list
(torch) D:\MyData\xiazw8.CN\Desktop\Python\Python+\Python_base\tensorboard>conda env list
base                     D:\MyData\x8.CN\Anaconda3
detectron2               D:\MyData\x8.CN\Anaconda3\envs\detectron2
ssl                      D:\MyData\x8.CN\Anaconda3\envs\ssl
torch                 *  D:\MyData\x8.CN\Anaconda3\envs\torch
  • 激活想在jupyter notebook中使用的虚拟环境,比如说torch
D:\MyData\x8.CN\Desktop\Python\Python+\Python_base\tensorboard>conda activate torch
(torch) D:\MyData\x8.CN\Desktop\Python\Python+\Python_base\tensorboard>
  • 在虚拟环境torch中安装ipykernel
pip install ipykernel
conda install ipykernel
# 两条命令都行
(torch) D:\MyData\x8.CN\Desktop\Python\2-classes>pip install ipykernel
Looking in indexes: https:
;