reference:https://www.jianshu.com/p/edbedd55bb49
筆者使用window10,其他系統相應命令可自行替換
在jupyter notebook中切換kernel
image.png
爲不同的環境配置kernel
有時候使用conda命令創建了新的python環境(假設是tensorflow),但是使用上面的方法並不能切換,因爲Change kernel
中並沒有新創建的環境。
conda creare -n tensorflow python=3.6
解決方案是手動添加這一kernel,具體步驟如下:
- 切換到需要配置的環境(這裏是tensorflow)
activate tensorflow
- 安裝
ipykernel
pip install ipykernel
- 手動添加這一kernel
python -m ipykernel install --name tensorflow --display-name "tensorflow(python3.6)"
--name
被用於jupyter內部,這一命令將覆蓋具有相同名稱的kernel--display-name
指定jupyter notebook中顯示的名字
其他
- 可以使用命令
jupyter kernelspec list
查看當前所有可用的kernelimage