使用ssh访问远端notebook¶
- 远端服务器启动notebook, jupyter notebook, 记下端口号和口令(或标志token)
- 设置ssh隧道连接远程服务器, 为了避免分不清端口代表远程还是本地, 直接设置成一样就好了:
ssh -N -L port:localhost:port@ -
本地浏览器打开 http://localhost:port/?token=abcdefghijklmnopqrstuvwxyl01234567890
-
Start jupyter notebook at remote server: jupyter notebook, Note: the port, passward or the token
- Set ssh tunnel to connect to remote server. To avoid confusing about the remote and local ports, just set the same port for both of them:
ssh -N -L port:localhost:port@ - Open local browser with token: http://localhost:port/?token=abcdefghijklmnopqrstuvwxyl01234567890
Jupyter 魔术命令 magic command¶
自动重新读入python模块¶
%load_ext autoreload
%autoreload 2
文件相关¶
%load 导入python文件
%%writefile
其他¶
%env 设置环境变量(无需重启)
%debug
%pdb 控制pdb交互式调试器的自动调用