Launch IPython notebook with selected browser

前端 未结 9 1587
暖寄归人
暖寄归人 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:39

    I set the environment variable BROWSER to the the executable of the browser (in my case Google Chrome), and Ipython Notebook started in the browser I liked.

    PS H:\> $env:BROWSER = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
    PS H:\> $env:BROWSER
    C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
    PS H:\>
    PS H:\> ipython notebook
    2015-02-19 14:05:01.690 [NotebookApp] Using existing profile dir: C:\\Users\\abc\\.ipython\\profile_default'
    2015-02-19 14:05:01.832 [NotebookApp] Using MathJax from CDN: http://cdn.mathjax.org/mathjax/latest/MathJax.js
    2015-02-19 14:05:01.901 [NotebookApp] The port 8888 is already in use, trying another random port.
    2015-02-19 14:05:01.908 [NotebookApp] Serving notebooks from local directory: H:\
    2015-02-19 14:05:01.908 [NotebookApp] 0 active kernels
    2015-02-19 14:05:01.910 [NotebookApp] The IPython Notebook is running at: http://localhost:8889/
    2015-02-19 14:05:01.910 [NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
    
    0 讨论(0)
  • 2020-12-02 06:42

    I had the same problem on windows and got it work this way:

    • Create a config file with command ipython profile create default

    • Edit ipython_notebook_config.py file, search for line

    #c.NotebookApp.browser =''

    and replace it with

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

    then it works for me.

    Hope it will help you.

    JPG

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

    Without coding, you can just set your default browser to Chrome or Firefox etc. It works for my windows system.

    0 讨论(0)
提交回复
热议问题