美文网首页我爱编程
在jupyter notebook中添加conda创建的环境(k

在jupyter notebook中添加conda创建的环境(k

作者: Huangjs1994 | 来源:发表于2018-05-19 01:10 被阅读83次

笔者使用window10,其他系统相应命令可自行替换

在jupyter notebook中切换kernel

image.png

为不同的环境配置kernel

有时候使用conda命令创建了新的python环境(假设是tensorflow),但是使用上面的方法并不能切换,因为Change kernel中并没有新创建的环境。

conda creare -n tensorflow python=3.6

解决方案是手动添加这一kernel,具体步骤如下:

  1. 切换到需要配置的环境(这里是tensorflow)
activate tensorflow
  1. 安装ipykernel
pip install ipykernel
  1. 手动添加这一kernel
python -m ipykernel install --name tensorflow --display-name "tensorflow(python3.6)"
  • --name被用于jupyter内部,这一命令将覆盖具有相同名称的kernel
  • --display-name指定jupyter notebook中显示的名字

其他

  • 可以使用命令jupyter kernelspec list查看当前所有可用的kernel
    image

参考资料

相关文章

网友评论

    本文标题:在jupyter notebook中添加conda创建的环境(k

    本文链接:https://www.haomeiwen.com/subject/hqtodftx.html