Launch IPython notebook with selected browser

前端 未结 9 1586
暖寄归人
暖寄归人 2020-12-02 05:57

I am trying to start IPython with a non default browser (in my case Firefox) and thought I could replicate the replicate the script given in this blog

I am o

相关标签:
9条回答
  • 2020-12-02 06:17

    On my mac, I got the following command to use Firefox instead of my default Chrome:

    jupyter notebook --browser firefox
    
    0 讨论(0)
  • 2020-12-02 06:19

    When you execute the below code in command prompt it gives the result link which you can copy in any browser to open Jupiter notebook.

    jupyter notebook --browser firefox
    
    0 讨论(0)
  • 2020-12-02 06:22

    I tried what JPG and norfeldt suggested. It worked perfectly on my Windows 7 computer. Here is a copy of the modified section of ipython_notebook_config.py (located under C:\Users\'your username'\.ipython to use Safari as the default browser for notebook. As norfeldt said, please notice the u before 'C:\...)

    # c.NotebookApp.certfile = u''
    
    import webbrowser
    webbrowser.register('safari', None, webbrowser.GenericBrowser(u'C:\\Program Files (x86)\\Safari\\safari.exe'))
    c.NotebookApp.browser = 'safari'
    
    0 讨论(0)
  • 2020-12-02 06:34

    This is not a real answer. I just want to share with the less computer savvy what JPG's answer looks like step-by-step. Presumably, on Windows Explorer (screen capture attached below), the file jupyter_notebook_config.py is listed:

    In my case, the directory for the file (on top menu of Explorer) was C:\Users\My_name\.jupyter

    The second part of the answer can be implemented by simply pasting:

    import webbrowser
    webbrowser.register('firefox', None, webbrowser.GenericBrowser('C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe'))
    c.NotebookApp.browser = 'firefox'
    

    in the space on the space seen on the screen capture below, corresponding to the jupyter_notebook_config.py opened within PyCharm:

    ... only that I set it up to open in Opera:

    import webbrowser
    webbrowser.register('opera', None, webbrowser.GenericBrowser('C:\\Program Files (x86)\\Opera\\launcher.exe'))
    c.NotebookApp.browser = 'opera'
    
    0 讨论(0)
  • 2020-12-02 06:36

    I uncomment this line and change into False, not to make ipython notebook open a web browser at start, so we can point the ipython notebook address in an active web browser.

    # Whether to open in a browser after starting. The specific browser used is
    # platform dependent and determined by the python standard library `webbrowser`
    # module, unless it is overridden using the --browser (NotebookApp.browser)
    # configuration option.
    c.NotebookApp.open_browser = False
    

    Better still, I pin the address in my Firefox to make it active everytime I open the browser.

    0 讨论(0)
  • 2020-12-02 06:37

    Why not use

    --browser=<Unicode> (NotebookApp.browser)
        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
    
    0 讨论(0)
提交回复
热议问题