天天看点

jupyter notebook无法自动打开浏览器解决方案

首先安装好jupyter notebook,我自己使用的anaconda环境,比较方便。

conda install jupyeter notebook
           

安装好后打开cmd,输入jupyter notebook,出现如下情况,无法自动跳转到浏览器,每次都要自己手动复制网址,很麻烦。

jupyter notebook无法自动打开浏览器解决方案

解决方案如下:

import webbrowser
webbrowser.register('chrome',None,webbrowser.GenericBrowser(r"C:\Users\11201\AppData\Local\Google\Chrome\Application\chrome.exe"))
c.NotebookApp.browser = 'chrome'
           

到C:\Users\11201.jupyter目录下找到文件jupyter_notebook_config,我自己装在了C盘,根据每个人的情况自己确定,然后点进去找到c.NotebookApp.browser = ’ '这行,大概在101行。chrome是自己所用的浏览器,C:\Users\11201\AppData\Local\Google\Chrome\Application\chrome.exe是浏览器所在的位置,添加进来,control+s保存,重新再cmd中输入jupyter notebook,就会自动跳转到指定浏览器。

jupyter notebook无法自动打开浏览器解决方案

继续阅读