我正在尝试在Ubuntu 14.04上安装和运行Jupyter。安装似乎没问题,但是当我打开浏览器并尝试打开Python笔记本时,浏览器会弹出一个窗口,其中包含连接失败标题:
无法建立与笔记本电脑服务器的连接。笔记本电脑将继续尝试重新连接。检查网络连接或笔记本服务器配置。
问题出在服务器端:Jupyter无法找到 nbextensions 资源,如下面的警告线所示:
404 GET /nbextensions/widgets/notebook/js/extension.js
之前已经提出此错误,但没有建议的解决方案为我解决。 我在Ubuntu 16.04上遇到了同样的问题。
这是我的配置:
~$ python -V
Python 3.5.3
~$ pip3 -V
pip 9.0.1 from /opt/python3.5/lib/python3.5/site-packages (python 3.5)
~$ jupyter --version
4.2.1
~$ jupyter notebook --version
4.3.2
这是服务器上的Jupyter输出:
~$ jupyter notebook --ip=192.168.2.15 --port=8080 --no-browser
[I 15:46:03.317 NotebookApp] Serving notebooks from local directory: /home/foo
[I 15:46:03.318 NotebookApp] 0 active kernels
[I 15:46:03.318 NotebookApp] The Jupyter Notebook is running at: http://192.168.2.15:8080/?token=9df9879c1ce98a4b9bff1c483110a00d08fa1645ec09bdc8
[I 15:46:03.318 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 15:46:03.318 NotebookApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://192.168.2.15:8080/?token=9df9879c1ce98a4b9bff1c483110a00d08fa1645ec09bdc8
[I 15:46:22.058 NotebookApp] Creating new notebook in
[W 15:46:22.645 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20170209154602 (161.106.4.5) 10.77ms referer=http://blabla:8080/notebooks/Untitled1.ipynb?kernel_name=python3
[I 15:46:22.749 NotebookApp] Kernel started: c35da40d-1ba0-4680-80f7-b0ab28c3f75c
答案 0 :(得分:1)
需要加载nbextensions
安装pip3 install ipywidgets
更改档案:~/.jupyter/nbconfig/notebook.json
{
"load_extensions": {
"jupyter-js-widgets/extension": true
}
}
其他套餐:
pip3 install jupyter-js-widgets-nbextension
pip3 install nbextensions
重新运行jupyter Notebook