- 查看當前 jupyter 中有哪些 kernel
jupyter kernelspec list
--------------------------------------------------------------------------------------------
2. 刪除指定 kernel
jupyter kernelspec remove kernel_name
-----------------------------------------------------------------------------------------------
3. 增加指定 kernel
- 先進入相應的虛擬環境
conda activate name
- 然后再用
which python
找到當前虛擬環境下的 python 位置
(pytorch) user-name@406:~$ which python
/home/user-name/anaconda3/envs/pytorch/bin/python
- 然后再輸入,其中 XXXX 是你想要的 kernel name,由於權限問題可能要加 sudo
sudo /home/user-name/anaconda3/envs/pytorch/bin/python -m ipykernel install --name XXXX
注意:這里不能直接使用 sudo python
因為這樣會對應到默認的python,而不是虛擬環境中的 python,因此直接輸入虛擬環境的具體位置