用pip安装了jupyter,但是执行命令jupyter notebook,打开的IE浏览器是空白页。网友给出的方法一般如下:
第一步:执行命令 jupyter notebook --generate-config,得到jupyter配置文件地址。
第二步:Overwrite C:\Users\Administrator\.jupyter\jupyter_notebook_config.py with defaul
t config? [y/N],按照运行得到的地址,打开配置文件
找到如下代码(95-99行):
## Specify what command to use to invoke a web browser when opening the notebook.
# If not specified, the default browser will be determined by the `webbrowser`
# standard library module, which allows setting of the BROWSER environment
# variable to override it.
#c.NotebookApp.browser = ''
在下面,增加如下代码:
import webbrowser
webbrowser.register('chrome', None, webbrowser.GenericBrowser(u'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'))
c.NotebookApp.browser = 'chrome'
C:\Program Files (x86)\Google\Chrome\Application\chrome.exe是我电脑谷歌浏览器的地址,可以根据自己的喜好配置浏览器,保存并退出。
再次运行jupyter notebook,我发现并没有打开所设置的谷歌浏览器,但是运行结果如下:
但是可以看到绿框中的描述,可以把通过复制到浏览器打开。于是不嫌麻烦的我把红框中的地址+token右键标记,然后粘贴到浏览器就OK了,这也是我每次运行jupyter的方式。。。