How to change the default browser used by jupyter notebook in windows

后端 未结 19 2344
盖世英雄少女心
盖世英雄少女心 2020-12-04 10:17

I\'m on a windows machine without admin right and I would like to run jupyter on chrome, while the default browser is another.

I have a local installation of the Ana

19条回答
  •  醉梦人生
    2020-12-04 10:57

    After considerable thrashing about trying to launch a jupyter notebook in chrome from Anaconda in Win10 when chrome was not my default browser, I combined several of the suggestions above and, in the jupyter_notebook_config.py file under .jupyter in my home directory put in these lines in place of the default c.NotebookApp.browser line, and it finally worked!:

    import webbrowser
    webbrowser.register('chrome', None, webbrowser.GenericBrowser(u'C:/PROGRA~2/Google/Chrome/Application/chrome.exe'))
    c.NotebookApp.browser = 'chrome'
    

    Note the use of Unix-style directory separators (this is apparently a bug in webbrowser) and the use of DOS-style "PROGRA~2" --- both of these seem to be necessary. Adding "%s" after "chrome.exe" seemed not to help.

提交回复
热议问题