首页 > 解决方案 > Jupyter notebook 停止在 AWS 服务器上运行

问题描述

我曾经运行这个 Jupyter 笔记本没有任何问题(使用 8889 端口),但从昨天开始我一直无法访问它。当我通过 ssh 连接到 AWS 上的服务器时会发生这种情况(如下)。当我在 Safari 中复制/粘贴此 URL 时,我收到以下消息:“Safari 无法打开页面,因为服务器意外断开了连接”。SSH 工作正常。由于我是 AWS 新手,因此我会感谢这个社区的帮助。

ssh [xxx]
ubuntu@ip-xxx:~$ cd mydir
ubuntu@ip-xxx:~/mydir$ source myenv/bin/activate
(myenv) ubuntu@ip-xxx:~/mydir$ jupyter notebook
[I xxx NotebookApp] The port 8888 is already in use, trying another port.
[I xxx NotebookApp] Serving notebooks from local directory: /home/ubuntu/mydir
[I xxx NotebookApp] The Jupyter Notebook is running at:
[I xxx NotebookApp] http://localhost:8889/?token=XXX
[I xxx NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W xxx NotebookApp] No web browser found: could not locate runnable browser.
[C xxx NotebookApp] 

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:8889/?token=XXX

标签: amazon-web-servicessshjupyter-notebook

解决方案


运行它以查看哪个进程正在使用该端口

sudo netstat -tupln | grep 8888

然后终止该进程并尝试再次启动笔记本。

sudo kill -9 PID

推荐阅读