美文网首页
远程访问 jupyter notebook

远程访问 jupyter notebook

作者: 数据小白鼠 | 来源:发表于2018-07-01 20:12 被阅读0次

    说明

    ipython notebook是一个基于浏览器的python数据分析工具,使用起来非常方便,具有极强的交互方式和富文本的展示效果。jupyter是它的升级版,它的安装也非常方便,一般Anaconda安装包中会自带。安装好以后直接输入jupyter notebook便可以在浏览器中使用。但是它默认只能在本地访问,如果想把它安装在服务器上,然后在本地远程访问,则需要进行如下配置。

    配置

    1. 登陆远程服务器
    2. 生成配置文件
    $jupyter notebook --generate-config
    
    1. 生成密码
      打开 ipython,创建一个密文的密码:
    In [1]: from notebook.auth import passwd
    In [2]: passwd()
    Enter password:
    Verify password:
    Out[2]: 'sha1:999b5409d375:3a76592b4b538c6cdf89162ac57864ed15e2f9a3'
    

    把生成的密文‘sha:ce…’复制下来

    1. 修改配置文件
    $vim ~/.jupyter/jupyter_notebook_config.py
    

    进行如下修改:

    c.NotebookApp.ip='*'
    c.NotebookApp.password = u'sha:ce...刚才复制的那个密文'
    c.NotebookApp.open_browser = False
    c.NotebookApp.port =8888 #随便指定一个端口
    
    1. 启动 jupyter notebook
    $jupyter notebook
    
    1. 远程访问
      此时应该可以直接从本地浏览器直接访问http://address_of_remote:8888就可以看到jupyter的登陆界面。
    2. 建立ssh通道
      如果登陆失败,则有可能是服务器防火墙设置的问题,此时最简单的方法是在本地建立一个ssh通道:
      在本地终端中输入ssh username@address_of_remote -L127.0.0.1:1234:127.0.0.1:8888
      便可以在localhost:1234直接访问远程的jupyter了。

    原文:https://blog.csdn.net/kunlong0909/article/details/52464495/

    相关文章

      网友评论

          本文标题:远程访问 jupyter notebook

          本文链接:https://www.haomeiwen.com/subject/pojhuftx.html