繁体   English   中英

如何在 Safari 中启动 Jupyter Notebook?

[英]How can I launch Jupyter Notebook in Safari?

我使用的是 Mac OS,我的默认浏览器是 Firefox。

在终端中,我运行了jupyter notebook --generate-config 然后,在文本编辑器中,我打开 ~/.jupyter/jupyter_notebook_config.py

我将c.NotebookApp.browser = u''更改为c.NotebookApp.browser = u'/Applications/Safari.app/Contents/MacOS/Safari %s'

但是,当我运行jupyter notebook ,我得到以下输出:

```
[I 15:14:23.717 NotebookApp] [nb_conda_kernels] enabled, 3 kernels found
[I 15:14:24.586 NotebookApp] [nb_anacondacloud] enabled
[I 15:14:24.589 NotebookApp] [nb_conda] enabled
[I 15:14:24.626 NotebookApp] ✓ nbpresent HTML export ENABLED
[W 15:14:24.626 NotebookApp] ✗ nbpresent PDF export DISABLED: No module named nbbrowserpdf.exporters.pdf
[I 15:14:24.632 NotebookApp] Serving notebooks from local directory: /Users/ironaut/Tutorials/DAND/Jupyter
[I 15:14:24.632 NotebookApp] 0 active kernels 
[I 15:14:24.632 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/?token=74a348c3fdec07e929dde216c244e1a9164badc47f079819
[I 15:14:24.632 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
Failed to acquire exclusive access to history store at file:///Users/ironaut/Library/Safari/History.db. Falling back to an in-memory history store.
[W 15:22:55.201 NotebookApp] 401 POST /login?next=%2Ftree%3F (::1) 1.30ms referer=http://localhost:8888/login?next=%2Ftree%3F
```

如果不更改配置文件,jupyter 在 Firefox 中可以正常启动。

你几乎完成了所有步骤。 为了读者的利益,重新迭代。

确保firefox是默认浏览器。 或与此相关的任何其他浏览器。

我使用atom作为文本编辑器。 随意使用任何其他。

执行

$ jupyter notebook --generate-config
$ atom ~/.jupyter/jupyter_notebook_config.py

发现并改变

c.NotebookApp.browser = u''

c.NotebookApp.browser = u'/usr/bin/open -a Safari %s'

测试

$ jupyter notebook

打开:vim .jupyter/jupyter_notebook_config.py

查找 > c.NotebookApp.ip = 'localhost' 更改 > c.NotebookApp.ip = '127.0.0.1'

但是,请删除开头的 # 符号。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM