29
Jupyter 集成 go 内核
source link: https://studygolang.com/articles/25014
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
基于 gophernotes .
依赖
-
Go 1.9+
- including GOPATH/bin added to your PATH (i.e., you can run Go binaries that you
go install
). - Jupyter Notebook or nteract
- ZeroMQ 4.X.X - for convenience, pre-built Windows binaries (v4.2.1) are included in the zmq-win directory.
- pkg-config
ZeroMQ的安装
# centos yum install zeromq
其他系统,见 https://zeromq.org/download/#linux
安装 gophernotes
以centos为例
$ go get -u github.com/gopherdata/gophernotes $ mkdir -p ~/.local/share/jupyter/kernels/gophernotes $ cp $GOPATH/src/github.com/gopherdata/gophernotes/kernel/* ~/.local/share/jupyter/kernels/gophernotes
-
服务器 go get 有翻墙问题的,可以参考 https://shockerli.net/post/go-get-golang-org-x-solution/
,通过修改
GOPROXY 环境变量
的方式解决。 - 命令目的是:在jupyter内核新建gophernotes的文件
-
cp 的源目录,需要你自己确定
gophernotes package
被安装到哪个位置。然后检查~/.local/share/jupyter\kernels\gophernotes\kernel.json
文件 的 "argv" 数组的 gophernotes 路径是否正确,如"/root/go/bin/gophernotes"
将 gophernotes
添加至 PATH
,执行 gophernotes
命令,得到如下输出,说明安装成功。
$ gophernotes 2017/09/20 10:33:12 Need a command line argument specifying the connection file.
最后重启 Jupyter
完成。
supervisor
如果你是用supervisor帮你管理jupyter的进程,那你需要将go相关的环境变量写入进程的.ini配置文件。举例:
[program:jupyter-notebook] ... ... environment=ENV="dev",PATH="/usr/local/go/bin:/root/go/bin:/usr/bin:$PATH",GOPROXY="https://goproxy.cn",GO111MODULE="on"
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK