前提

已经进行了vscode远程离线服务器以及wrf-python+jupyter noteobook环境配置的操作,可以实现浏览器操作,此贴目的为了方便代码修改和运行。

安装jupyter扩展(远程服务器上)

安装成功后可以在Extensions中看到远程主机的扩展,搜索jupyter,在远程主机安装jupyter:
图片1
安装会比较慢,如果安装失败可以挂梯子或者尝试.vsix的方式

配置jupyter server

在服务器.jupyter/jupyter_notebook_config.py修改

1
2
3
4
5
6
7
8
9
c.ServerApp.root_dir=' ' # jupyter_notebook_config.py所在路径
c.ServerApp.ip='*' #notebook监听所有ip地址

# 重要配置!!!
c.ServerApp.allow_remote_access = True #允许远程访问服务
c.ServerApp.allow_root = True #允许在root用户下运行(之前没开这个配置排查了很久)
c.NotebookApp.allow_origin = '*' #允许任意源访问
c.ServerApp.trust_xheaders = True
c.ServerApp.disable_check_xsrf = True

连接jupyter

图片2
图片3
后续需要输入jupyter的地址,在浏览中跳转的是
http://localhost:8888/,输入自己的密码即可。