我是靠谱客的博主 生动发卡,这篇文章主要介绍为Jupyter Notebook添加Kernel(Win10+Ubuntu18.04)为Jupyter Notebook添加Kernel,现在分享给大家,希望可以做个参考。


为Jupyter Notebook添加Kernel

代码如下:

conda activate 环境名 #先切换到目标环境下

#安装ipykernel
pip install -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com ipykernel  #从国内源下载并信任该源

python -m ipykernel install --name 环境名  #添加该环境的kernel,这里的环境名可以任意取,推荐和activate的环境名一致,便于辨识。

jupyter kernelspec list   # 查看现有kernel列表 

jupyter kernelspec remove 环境名  # 删除已存在的kernel


笔者在Ubuntu下为Jupyter Notebook添加kernel时运行:

sudo python -m ipykernel install --name 环境名

遇到报错:

/usr/bin/python: No module named ipykernel

把语句中python改成python3即可:

sudo python3 -m ipykernel install --name 环境名

添加kernel成功:

Installed kernelspec DLC in /usr/local/share/jupyter/kernels/dlc

刷新或重启jupyter notebook即可看到新加入的内核。


最后

以上就是生动发卡最近收集整理的关于为Jupyter Notebook添加Kernel(Win10+Ubuntu18.04)为Jupyter Notebook添加Kernel的全部内容,更多相关为Jupyter内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(43)

评论列表共有 0 条评论

立即
投稿
返回
顶部