目录

Ubuntu Jupyter Notebook配置golang和python

Jupyter配置golang和python

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
sudo apt install golang
go env
jupyter kernelspec list
python --version
conda create -n py27 python=2.7
conda create -n py27 python=2.7 ipykernel
conda install --prefix=/home/mulinux/anaconda3/envs/py27 ipykernel
sudo apt-get install python2-pip
wget http://bootstrap.pypa.io/get-pip.py
sudo python2.7 get-pip.py
sudo pip2 install ipykernel
/root/anaconda3/envs/py27/bin/pip install backports.functools_lru_cache
/root/anaconda3/envs/py27/bin/pip install tornado==4.5.3
python2.7 -m ipykernel install --user
sudo apt-get install libzmq3-dev
sudo apt-get install pkg-config
go get -u github.com/gopherdata/gophernotes
mkdir -p ~/.local/share/jupyter/kernels/gophernotes
cp /home/mulinux/go/src/github.com/gopherdata/gophernotes/kernel/* ~/.local/share/jupyter/kernels/gophernotes
cd ~/.local/share/jupyter/kernels/gophernotes
chmod +w kernel.json
sudo ln -s $HOME/go/bin/gophernotes /usr/bin/gophernotes
gophernotes

sudo apt-get remove golang libzmq3-dev
清理系统:
sudo apt-get autoclean
sudo apt-get clean
sudo apt-get autoremove
sudo rm -rf /usr/lib/go-1.10
sudo rm -rf /home/mulinux/go
wget https://dl.google.com/go/go1.12.7.linux-amd64.tar.gz
tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
export PATH=$PATH:/usr/local/go/bin

备注

jupyter notebook下不支持 package main和main函数的写法,会报runtime error: index out of range

参考

1
2
https://www.chenshaowen.com/blog/install-python3-and-go-kernel-in-jupyter.html
https://github.com/gopherdata/gophernotes