在命令行进行jupyter kernel创建、查看、删除

12 篇文章 0 订阅
9 篇文章 0 订阅

以下内容基于:
conda            : 4.9.1
jupyter core     : 4.6.3
jupyter-notebook : 6.0.3
编写,如有任何差异,请以实际环境版本文档为准。

JUPYTER命令格式

jupyter [-h] [--version] [--config-dir] [--data-dir] [--runtime-dir] [--paths] [--json] [subcommand]

其中:

  -h, --help     show this help message and exit
  --version      show the jupyter command's version and exit
  --config-dir   show Jupyter config dir
  --data-dir     show Jupyter data dir
  --runtime-dir  show Jupyter runtime dir
  --paths        show all Jupyter paths. Add --json for machine-readable format.
  --json         output paths as machine-readable json

subcommand是子命令,包含:

bundlerextension console kernel kernelspec lab labextension migrate nbconvert nbextension notebook qtconsole run script serverextension troubleshoot trust

创建环境

conda create -n py36 python=36 # 创建一个python36的环境,名为py36
source activate py36 # 激活py36环境
conda install ipykernel # 安装ipykernel模块
#进行配置 名字为py36显示为py3636
python -m ipykernel install --user --name py36 --display-name “py3636”
jupyter notebook # 启动jupyter notebook

新建内核后,会生成一个kernel.json的配置文件,文件路径可用下述命令查看。

查看安装的内核和对应配置文件位置

jupyter kernelspec list

注1:在jupter notebook的网页界面上,当进行新建notebook或切换notebook内核的操作时,都会有内核选择列表。这个列表列出了两种来源的内核:一种是根据jupyter kernelspec list列出的路径中的内核配置文件显示已有内核的名称;另一种是在conda安装目录下搜索到的conda的根环境和虚拟环境。

注2:由于未知的bug,在jupyter中使用jupyter kernelspec list的虚拟环境内核,有可能没有真正切换到指定虚拟环境,最好在jupyter cell运行

!where python

检查确认。

删除内核

jupyter kernelspec remove py36 #删除内核py36

参考资料:

​​​​​​​Jupyter Project Documentation

jupyter kernel创建 删除_ying______的博客-CSDN博客

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值