编程语言
首页 > 编程语言> > 交互式编程之Golang基本配置(Jupyter-notebooks Golang)

交互式编程之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

gophernotesgo内核,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文件或文件夹

修改kernelsgophernoteskernel.jsonargv的参数

# 原来的
{
    "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的问题

标签:gophernotes,Jupyter,name,notebooks,Golang,go,PATH,NotebookApp,root
来源: https://www.cnblogs.com/yuzw/p/10432549.html