【PuTTY】本地启动远程服务器的 jupyter notebook

1,登录 PuTTY, 并打开 jupyter notebook

$ jupyter notebook

2,查看 jupyter notebook 分配的端口号

[W 15:51:46.473 NotebookApp] No web browser found: could not locate runnable browser.
[C 15:51:46.473 NotebookApp]

    To access the notebook, open this file in a browser:
        file:///xxxx/xxx/.local/share/jupyter/runtime/nbserver-xxxx-open.html
    Or copy and paste one of these URLs:
        http://localhost:1234/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
     or http://xxx.x.x.x:1234/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

3,退出 jupyter notebook 和 PuTTY

Ctrl + C // 退出 jupyter notebook
exit // 退出 PuTTY

4,打开 PuTTY,并填好 IP 和 Port (这一步之后才能进行下一步,不然无法连接 localhost)

5,打开 PuTTY Configuration -> Connection -> SSH -> Tunnels

4,配置 Source port 和 Destination,并打开 PuTTY

  • Source port: 本地打开的端口号(自定义)
  • Destination: 服务器分配给你的端口号,根据第二步服务器返回给你的 localhost:1234 直接往里填

5,接下来激活环境,打开 jupyter notebook
6,浏览器中打开地址:localhost:8888
7,填写 token 就能够连接远程服务器的 jupyter notebook 了!

参考资料
https://blog.csdn.net/u013517182/article/details/93032819
https://blog.csdn.net/herokoking/article/details/90438069

posted @ 2021-06-04 16:38  林東雨  阅读(793)  评论(0编辑  收藏  举报