gpt4 book ai didi

python - 在同一个端口运行的两个 jupyter notebook

转载 作者:行者123 更新时间:2023-12-04 18:25:54 31 4
gpt4 key购买 nike

我在 Windows 10 上使用 Ubuntu 子系统。

我打开一个终端并输入命令:

jupyter notebook 

然后在 8888 端口启动一个笔记本。没有关闭这个,我打开了另一个终端并再次输入 jupyter notebook,新终端说:

[I 15:09:00.576 NotebookApp] The Jupyter Notebook is running at:
[I 15:09:00.577 NotebookApp] http://localhost:8888/?token=

使用与第一个终端中运行的笔记本不同的 token 号。如果我用浏览器打开 localhost:8888 并从第二个终端输入 token ,jupyter 会拒绝我,而第一个终端的 token 会通过。

我想知道为什么两个笔记本可以运行在同一个8888端口上?如果我在第二个终端中杀死笔记本,是否会影响在第一个终端中运行的笔记本?

最佳答案

简短的回答 - 你不能在同一个端口上运行 2 个笔记本服务器。

来自 Jupyter documentation :

You can start more than one notebook server at the same time, if you want to work on notebooks in different directories. By default the first notebook server starts on port 8888, and later notebook servers search for ports near that one. You can also manually specify the port with the --port option.

这可能是网络问题或由您的环境配置引起的。基本上,对于 TCP/IP,您一次只能让一个应用程序监听同一端口。现在,如果您有 2 个网卡,您可以让一个应用程序监听第一个 IP,第二个应用程序使用相同的端口号监听第二个 IP。对于 UDP(多播),多个应用程序可以订阅同一个端口。

您始终可以使用 --port 选项和您选择的端口运行第二个服务器。

关于python - 在同一个端口运行的两个 jupyter notebook,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53228455/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com