在服务器端安装notebook
pip install jupyter notebook1.2 开启 jupyter notebook
在服务器端开启 jupyter notebook,–no-browser 是不自动打开浏览器:
jupyter notebook --no-browser
jupyter服务默认发布至本地的8888端口,开启成功后会出现如下界面:
注:复制倒数第二行的 token,这个 token 就是远程访问的密码,同时记下端口号8888。
在 PC 端做一个端口映射,即通过 ssh 隧道来将服务器端的8888端口号映射到本地(PC端)的某个端口(如1234):
ssh -L 1234:localhost:8888 username@xxx.xxx.xxx.xxx # username@xxx.xxx.xxx.xxx 为服务器的登录名和IP地址
接着输入服务器的访问密码,这时就可以在PC端的浏览器通过
http://localhost:1234
直接访问服务器上的 jupyter notebook 了。
2.2 输入密码打开 http://localhost:1234 后,会出现如下界面:
在Password or token 的输入框内输入之前复制的 token 就可以远程访问了。



