交互式编程之Golang基本配置(Jupyter-notebooks Golang)
JupyterNoteBook-GO
如有错误,欢迎指出
错误
error: Cannot assign requested address
无法将当前地址分配给jupyter notebook
c.NotebookApp.ip='123.21.242.32'
c.NotebookApp.password = u'sha1:f012129dbf38:a3673a44bc5145ef336ea6940db21676fce9f85a'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
c.NotebookApp.notebook_dir = '/root/home/Jupyter/'
c.InteractiveShellApp.matplotlib = 'inline'
解决:将c.NotebookApp.ip
改成0.0.0.0
c.NotebookApp.ip='0.0.0.0'
c.NotebookApp.password = u'sha1:f012129dbf38:a3673a44bc5145ef336ea6940db21676fce9f85a'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
c.NotebookApp.notebook_dir = '/root/home/Jupyter/'
c.InteractiveShellApp.matplotlib = 'inline'
Install-Go
golang源码
解压安装包
wget https://golang.org/dl/
获取软件包
tar -C /usr/local go*
将压缩包解压至/usr/local
,此路径为官方推荐
export PATH=/usr/local/go/bin:$PATH
配置命令环境
Install gophernotes
gophernotes
是go
内核,jupyter notebook
需要安装其才能使用go来启用交互式编程
官方教程
Question1:无法寻找命令
error: command not found: gophernotes
如果输入gophernotes
提示没有此命令,即可以按以下解决
find / -name 'gophernotes'
寻找系统gophernotes
命令
例如返回路径/root/go/bin:$PATH
export PATH=/root/go/bin:$PATH
正常即可获取响应2019/02/25 15:43:04 Need a command line argument specifying the connection file.
Question2:内存不足,溢出
error: fatal error: runtime: out of memory
内存过小,造成溢出。
解决方案:建立swap分区
图片摘自参考资料2
Question3:jupyter内核错误,提示没有gophernotes
文件或文件夹
修改kernels
中gophernotes
的kernel.json
中argv
的参数
# 原来的
{
"argv": [
"gophernotes",
"{connection_file}"
],
"display_name": "Go",
"language": "go",
"name": "go"
}
# 现在的,将命令变成绝对路径
{
"argv": [
"/root/go/bin/gophernotes",
"{connection_file}"
],
"display_name": "Go",
"language": "go",
"name": "go"
}
重启jupyter-notebook
即可
参考资料
1.gophernotes的github教程
2.如何建立swap分区
3.WillZhuang的博客之内存溢出解决
4.缺少libzmq
的问题