jupyter notebook 远程访问

网上有设置配置文件的方式,我自己尝试了,最后没效果,遂采用下面的笨方法。

首先确定外界可以访问主机服务,比如开启端口之类,见前一篇文章。

然后开启服务,指定ip port:

jupyter notebook --no-browser --port 6000 --ip=192.168.1.103

--no-browser 指的是不自动打开浏览器

如果需要root开启的话,需要加参数 --allow-root

 

其他主机访问,访问http://ip:port。打开后,需要输入密码或者token。因为我不是通过配置文件做的,没有密码,但是主机终端开启jupyter服务时,会显示token,拷贝出来,访问即可。

 

https://www.cnblogs.com/jiu0821/p/8544216.html

 

如果正常启动

jupyter notebook 远程访问

通过本机IP访问都不行,就更不提远程访问了

jupyter notebook 远程访问

记得当时在说设置默认工作路径的时候,提过配置文件https://www.cnblogs.com/dotnetcrazy/p/9261524.html 

生成配置文件:jupyter-notebook --generate-config

配置文件其实也是可以支持远程访问的(服务器同样适用)

code ~/.jupyter/jupyter_notebook_config.py 【没装VSCode的可以用gedit ~/.jupyter/jupyter_notebook_config.py 】

jupyter notebook 远程访问

只是我们只想临时远程共享而进行部分代码演示,有没有简单方法呢?

==》jupyter-notebook --ip=*

jupyter notebook 远程访问

访问:http://192.168.36.235:8888?token=xxx

jupyter notebook 远程访问

OK了

jupyter notebook 远程访问

Win10远程测试:

jupyter notebook 远程访问

 

扩展:(反向代理也可以实现)

如果是SSH连接远程服务器在登出的时候运行的程序被信号杀了怎么办?

可以使用nohup(进程不响应SIGHUP信号)

nohup jupyter notebook --ip=*

https://www.cnblogs.com/dotnetcrazy/p/9552419.html