admin 管理员组

文章数量: 1184232

让 Jupyter notebook 自动打开浏览器

首先打开 Anaconda Prompt,然后输入:

jupyter notebook --generate-config

然后通过 Everything 软件查找文件 jupyter_notebook_config.py 并将其打开。

定位以下代码:

## The directory to use for notebooks and kernels.
#c.NotebookApp.notebook_dir = ''

在以上代码下面加入如下代码:

import webbrowser
webbrowser.register('chrome',None,webbrowser.GenericBrowser(u'D:/Googlechrome/Google/Chrome/Application/chrome.exe'))
c.NotebookApp.browser = 'chrome'

注意其中的 'D:/Googlechrome/Google/Chrome/Application/chrome.exe' 路径是你电脑 chrome.exe 所在的位置,如果想换其他浏览器同理。

保存后,此时在 cmd 中输入 jupyter notebook 就可以让其自动打开浏览器。

本文标签: 打开浏览器 jupyter notebook