基于 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
其他系統(tǒng)眷昆,見 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
- 服務(wù)器 go get 有翻墻問題的蜒秤,可以參考https://shockerli.net/post/go-get-golang-org-x-solution/汁咏,通過修改
GOPROXY 環(huán)境變量
的方式解決。 - 命令目的是:在jupyter內(nèi)核新建gophernotes的文件
- cp 的源目錄,需要你自己確定
gophernotes package
被安裝到哪個位置作媚。然后檢查~/.local/share/jupyter\kernels\gophernotes\kernel.json
文件 的 "argv" 數(shù)組的 gophernotes 路徑是否正確攘滩,如"/root/go/bin/gophernotes"
將 gophernotes
添加至 PATH
,執(zhí)行 gophernotes
命令纸泡,得到如下輸出漂问,說明安裝成功。
$ gophernotes
2017/09/20 10:33:12 Need a command line argument specifying the connection file.
最后重啟 Jupyter
完成女揭。
supervisor
如果你是用supervisor幫你管理jupyter的進程蚤假,那你需要將go相關(guān)的環(huán)境變量寫入進程的.ini配置文件。舉例:
[program:jupyter-notebook]
...
...
environment=ENV="dev",PATH="/usr/local/go/bin:/root/go/bin:/usr/bin:$PATH",GOPROXY="https://goproxy.cn",GO111MODULE="on"