如何在Google合作实验室中运行Golang

时间:2019-01-20 13:40:12

标签: go kernel jupyter-notebook google-colaboratory gophernotes

现在,Google Colaboratory支持Python2和Python3内核。是否可以添加Golang内核,以便我也可以在Colab中使用Golang?

我发现了一些示例here,但是它只有JavaScript和R,没有Golang。

1 个答案:

答案 0 :(得分:2)

首先,您需要从普通的Python笔记本中安装Golang内核(gophernotes)。

!apt install golang-go libzmq3-dev
%env GOPATH=/root/go
!go get -u github.com/gopherdata/gophernotes
!cp ~/go/bin/gophernotes /usr/bin/
!mkdir /usr/local/share/jupyter/kernels/gophernotes
!cp ~/go/src/github.com/gopherdata/gophernotes/kernel/* \
       /usr/local/share/jupyter/kernels/gophernotes

然后复制此go_1+1.ipynb 笔记本并运行它。