IPython笔记本WebSocket连接无法建立,无法运行代码

2 投票
1 回答
3496 浏览
提问于 2025-04-18 15:49

我一直在尝试在IPython笔记本中运行一些简单的代码,但总是遇到这个错误:

“无法建立WebSocket连接。你将无法运行代码。请检查你的网络连接或笔记本服务器配置。”

安装过程中没有问题,加载笔记本时也没有错误信息。

我在想,可能是因为我在用xamp运行本地服务器的缘故?

有没有人知道怎么解决这个问题?

我会非常感激。

编辑:我是在命令提示符中用'ipython notebook'命令加载我的笔记本,输出是:

[NotebookApp]"Using existing profile dir: c:\users\Nimrod\.ipython\profile_default
[NotebookApp]using MathJax from CDN: http://cdn.mathjax.org/mathjax/latest/mathjax.js
[NotebookApp] Serving notebooks from local directory c:\users\Nimrod
[NotebookApp] 0 active kernels
[NotebookApp] use control c to stop server and shut doen all kernels
[NotebookApp] Kernel started: 0ac0db12-63a0-4a4a-be25-0051

非常感谢。

1 个回答

0

好的,默认情况下,ipython notebook 是独立启动的,它使用的是本地的 tornado HTTP 服务器,运行在 8888 端口上。

你可以在浏览器里输入 localhost:8888 来访问它。

如果你想把它设置成在其他端口运行,可以使用:

ipython notebook --port=<NEW PORT>

如果你还想允许其他远程机器连接,可以使用:

ipython notebook --ip=0.0.0.0 --port=<NEW PORT>

撰写回答