在 LAN 上公开 python jupyter

Exposing python jupyter on LAN

我已经在本地网络 LAN 上安装了 jupyter,但我无法从 LAN 上的另一台计算机访问 http://<IP>:8888。我已经用 iptables 打开了端口 8888 和端口范围 49152 到 65535(这个范围在 http://jupyter-notebook.readthedocs.io/en/latest/public_server.html 指定)

本指南 http://jupyter-notebook.readthedocs.io/en/latest/public_server.html 描述了公开公开笔记本,但我只是尝试通过 LAN 共享。

我错过了一步吗?

尝试jupyter notebook --ip <your_LAN_ip> --port 8888 然后从另一台计算机访问http://your_LAN_ip:8888

建议您在访问笔记本服务器时使用密码。要设置密码,只需 运行 jupyter notebook password。为了使其更加安全,您可以通过将参数 --certfile--keyfile 传递给 jupyter notebook 来为您的服务器使用 SSL。您可以阅读有关设置的更多信息 here.

也可以在配置文件的c.NotebookApp.ip = '<your_ip_or_hostname>'c.NotebookApp.port = 8888参数中加入IP/host

如果您还没有 jupyter 配置文件 运行 jupyter notebook --generate-config

在 macOS 中,以下对我有用

0。使用

生成配置文件

jupyter notebook --generate-config

1。在配置文件中设置并添加

c.NotebookApp.ip = '0.0.0.0' # listen on all IPs
c.NotebookApp.token = ''     # disable authentication
c.NotebookApp.allow_origin = '*' # allow access from anywhere
c.NotebookApp.disable_check_xsrf = True # allow cross-site requests

2。 运行:

jupyter notebook --ip <your_LAN_ip> --port 8888