Golang Kernel For Jupyter-NoteBook

时间:2022-09-14 21:47:12

上篇回顾:VSCode and NoteBook for JavaScript

正常流程

安装Go语言:sudo apt install golang

安装内核的相关依赖包:sudo apt install libzmq3-dev pkg-config

Copy包到本地:go get -u github.com/gopherdata/gophernotes

Golang Kernel For Jupyter-NoteBook

在NoteBook中创建新的内核文件夹:mkdir -p ~/.local/share/jupyter/kernels/gophernotes

Golang Kernel For Jupyter-NoteBook

复制Go内核相关配置文件:

cp ~/go/src/github.com/gopherdata/gophernotes/kernel/* ~/.local/share/jupyter/kernels/gophernotes/

Golang Kernel For Jupyter-NoteBook

Golang Kernel For Jupyter-NoteBook

这时候NoteBook已经有Go内核的选项了(但是还不能用)

Golang Kernel For Jupyter-NoteBook

配置一下环境:echo 'export PATH="/home/用户名/go/bin:$PATH"' >> ~/.bashrc

Golang Kernel For Jupyter-NoteBook

更新一下环境:source ~/.bashrc

运行gophernotes

Golang Kernel For Jupyter-NoteBook

然后就正常使用了(个别情况reboot重启一下就ok了)

Golang Kernel For Jupyter-NoteBook

异常处理

如果失败可以查看下面内容:

  • 安装前需要安装相关依赖
  • 安装完成后记得导入下Path

Golang Kernel For Jupyter-NoteBook

扩展:环境变量执行顺序参考