Custom Search

Sunday, July 9, 2017

golang How to Install and Setup Jupyter notebook

1)
Download Go compiler from https://golang.org/dl/

2)
Extract it ($HOME/gocompiler/)

3)
Create a new directory for your go project ($HOME/golexamples/myproject1)

4)
Add the following lines to your $HOME/.bashrc

export GOROOT=$HOME/gocompiler/go
export PATH=$GOROOT/bin:$PATH

export GOPATH=$HOME/golexamples/myproject1
export PATH=$GOPATH/bin:$PATH

5)
$go help

6)
#we need pip >= 9
pip —version

7)
sudo pip install —upgrade pip

8)
pip —version

i)
sudo pip install jupyter

9)
#Run server
jupyter notebook

10)
Install goimports
go get golang.org/x/tools/cmd/goimports

11)
Install gaoling kernel
go get github.com/gophergala2016/gophernotes

12)
Create a directory for the new kernel config:
mkdir -p ~/.ipython/kernels/gophernotes

13)
Copy the kernel config into the .ipython directory:
cp -r $GOPATH/src/github.com/gophergala2016/gophernotes/kernel/* ~/.ipython/kernels/gophernotes

14)
Start the jupyter notebook:
jupyter notebook

15)
Then, select “Golang” from the “New” drop down menu

16)
Import “fmt”
World := “world”
fmt.Sprintf(“Hello %s”, world)





No comments:

Post a Comment