Var*_*ind 11 python jupyter jupyter-notebook
所以我在尝试打开 jupyter 笔记本时没有问题,但由于某种原因,无论我尝试做什么,我都无法让它在浏览器中自动打开。我遵循这些帖子无济于事: 无法在浏览器上打开 jupyter(ipython) notebook https://github.com/jupyter/notebook/issues/2130
我通过创建 jupyter 配置jupyter notebook --generate-config
并修改了这些设置:
c.NotebookApp.browser = 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe' c.NotebookApp.open_browser = True
c.NotebookApp.webbrowser_open_new = 2
它仍然不会在 chrome 中自动打开笔记本。我想知道我是否在做一些愚蠢的事情,但我不知道还能做什么。我在 Windows 10 上运行并通过 cygwin 启动 jupyter。当我jupyter notebook
在 cygwin 中输入(修改设置文件后)时,它给了我这个输出:
$ jupyter notebook
[I 21:57:41.782 NotebookApp] Serving notebooks from local directory: /cygdrive/c/home
[I 21:57:41.782 NotebookApp] The Jupyter Notebook is running at:
[I 21:57:41.782 NotebookApp] http://localhost:8888/?token=373da6a3a3ed7c5fb991f0b3b1042bff22e3fa946aea8bc1
[I 21:57:41.782 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 21:57:41.799 NotebookApp]
To access the notebook, open this file in a browser:
file:///cygdrive/c/home/.local/share/jupyter/runtime/nbserver-1003-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=373da6a3a3ed7c5fb991f0b3b1042bff22e3fa946aea8bc1
Run Code Online (Sandbox Code Playgroud)
还有什么我可以做的让它在浏览器中自动打开吗?
更新:我找到了这个链接,它也不起作用:用选定的浏览器启动 IPython notebook
我还发现这个设置是错误的:c.NotebookApp.browser = 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'
,它应该是:c.NotebookApp.browser = 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'
。但我仍然没有取得任何进展。:(
将此行添加到您的jupyter_notebook_config.py
文件中:
c.NotebookApp.use_redirect_file = False
Run Code Online (Sandbox Code Playgroud)
这应该会在浏览器中使用localhost
/ 127.0.0.1
URL自动打开 jupyter 笔记本。
为完整起见,更多信息:
~/.jupyter/jupyter_notebook_config.py
. 如果可以使用以下命令生成丢失(如您所做的那样):jupyter notebook --generate-config
小智 2
您可以通过在配置文件中将此设置设置为“false”来修复它
如果尚未完成,请生成配置文件: jupyter notebook --generate-config
然后将 ~/.jupyter/jupyter_notebook_config.py 中的 NotebookApp.use_redirect_file 更新为 False (默认为 True)
(来自https://jupyter-notebook.readthedocs.io/en/stable/config.html)
NotebookApp.use_redirect_fileBool
默认值:真
禁用通过重定向文件启动浏览器 对于笔记本 > 5.7.2 的版本,添加了一项安全功能措施,以防止用于启动浏览器的身份验证令牌可见。此功能使得多用户系统上的其他用户很难像您一样在您的 Jupyter 会话中运行代码。
但是,在某些环境(例如 Windows Subsystem for Linux (WSL) 和 Chromebook)中,使用重定向文件启动浏览器可能会导致浏览器无法加载。这是因为运行时和浏览器之间的文件结构/路径存在差异。将此设置禁用为 False 将禁用此行为,从而允许浏览器通过使用 URL 和可见令牌来启动(如前所述)。