zoukankan      html  css  js  c++  java
  • [转] 远程访问服务器Jupyter Notebook的两种方法

    From: https://www.jianshu.com/p/8fc3cd032d3c

    最近工作站的驱动崩了,无法显示图形界面,也没办法teamviewer了,这时候又需要运行ipython notebook,咋办呢,幸好搜罗到两种方法远程访问jupyter notebook的方法:

    方法1. ssh远程使用jupyter notebook

    1. 在远程服务器上,启动jupyter notebooks服务:
    jupyter notebook --no-browser --port=8889
    
    1. 在本地终端中启动SSH:
    ssh -N -f -L localhost:8888:localhost:8889 username@serverIP
    

    其中: -N 告诉SSH没有命令要被远程执行; -f 告诉SSH在后台执行; -L 是指定port forwarding的配置,远端端口是8889,本地的端口号的8888。

    注意:username@serverIP替换成服务器的对应账号。

    1. 最后打开浏览器,访问:http://localhost:8888/

    方法2. 利用jupyter notebook自带的远程访问功能

    官方指南在此:官方指南

    1. 生成默认配置文件
      jupyter notebook --generate-config
    2. 生成访问密码(token)
      终端输入ipython,设置你自己的jupyter访问密码,注意复制输出的sha1:xxxxxxxx密码串
    In [1]: from notebook.auth import passwd
    In [2]: passwd()
    Enter password:
    Verify password:
    Out[2]: 'sha1:xxxxxxxxxxxxxxxxx'
    
    1. 修改./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
    2. 最后打开浏览器,访问:http://ip:8888/

    方法3:

    配置自己的config文件,如./jupyter/jupyter_notebook_config_backup.py

    jupyter notebook --config ./jupyter/jupyter_notebook_config_backup.py
    
     
     
    8人点赞
     
    Python
     
     


    作者:ibunny
    链接:https://www.jianshu.com/p/8fc3cd032d3c
    来源:简书
    著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
  • 相关阅读:
    模块之间的消息传递优势与问题
    cp命令
    gimp的python控制台生成UI代码
    three.js(六) 地形法向量生成
    mysql 主从复制配置
    Three.js(九)perlin 2d噪音的生成
    three.js(五) 地形纹理混合
    mongodb 复制
    pycparse python的c语法分析器
    ajax出现 所需的数据还不可用
  • 原文地址:https://www.cnblogs.com/Arborday/p/12841627.html
Copyright © 2011-2022 走看看