jupyter部署和端口转发 - peter-xbs/CommonCodes GitHub Wiki
jupyter-notebook --generate-config
将生成~/.jupter/jupyter_notebook_config.py文件
执行编辑
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.port=8889
c.NotebookApp.allow_remote_access = True
jupyter-notebook password 设置密码
激活虚拟环境
- 执行安装Ipykernel
pip install ipykernel ipython
- 虚拟环境命名(显示在jupyter页面的名称)
ipython kernel install --user --name xxx
- 虚拟环境删除(将从Jupyter中移除显示)
jupyter kernelspec remove pytorch1.6
jupyter-notebook --allow-root
# ssh -L local-port:target-host:target-port tunnel-host
输入远端ECS密码即可 或者使用下图更友好的方式建立一个shell脚本运行进行转发
#!/usr/bin/expect
spawn ssh -N -f -L localhost:port_local:localhost:port_server user@host
expect "assword:"
send "xxx\r"
interact
HOST-A(local) --> Host-B(jump server) --> Host-C(GPU server) 在本地终端运行下述命令即可打通隧道:
ssh -L<Port-A>:localhost:<Port-B> user@Host-B -t ssh -L<Port-B>:localhost:<Port-C> user@Host-C
或者vscode可以链通情况下也可