Loading...

远程访问服务器Jupyter Notebook (浏览器访问和pycharm访问)

1.在remote server上运行

jupyter notebook --no-browser --port=8888 

复制远程终端显示的 token 序列

2.在本地终端上运行

ssh -L 8888:localhost:8888 <REMOTE_USER>@<REMOTE_HOST> 

e.g.

ssh -L 8888:localhost:8888 zhangsan@xx.xx.xx.xx -p 10001 

-p用来指定远程服务器用户的端口。

3.本地访问jupyter

(1) 在本地浏览器访问jupyter notebook

http://localhost:8888/?token=xxxxxxx 

?token=后面替换成你之前复制的token序列。

(2) 在pycharm中配置jupyter server

点击Configure Jupyter Server...
远程访问服务器Jupyter Notebook (浏览器访问和pycharm访问)
Configured Server处填入http://localhost:8888/?token=xxxx

远程访问服务器Jupyter Notebook (浏览器访问和pycharm访问)

同样的,在?token=后面添加之前复制的token序列。配置完成以后就可以使用pycharm远程访问jupyter notebook了。

参考
[1]: https://stackoverflow.com/questions/69244218/how-to-run-a-jupyter-notebook-through-a-remote-server-on-local-machine