How to set jupyter notebook to open on browser automatically

前端 未结 3 688
攒了一身酷
攒了一身酷 2021-02-14 23:01

So I don\'t have issues trying to open the jupyter notebook but for some reason, I cannot get it to open in the browser automatically no matter what I\'m trying to do. I follow

相关标签:
3条回答
  • 2021-02-14 23:41

    Add this line to your jupyter_notebook_config.py file:

    c.NotebookApp.use_redirect_file = False
    

    This should open jupyter notebooks automatically in your browser with the localhost/127.0.0.1 URL.

    More info for the sake of completeness:

    • The config file should be found in ~/.jupyter/jupyter_notebook_config.py. If missing can be generated (as you did) with the command: jupyter notebook --generate-config
    • Here's the Github issue where the change was discussed (the same solution was also highlighted here)
    • Here's the reference in the documentation
    0 讨论(0)
  • 2021-02-14 23:47

    At the command line, type:

    jupyter notebook --browser=<Browser>

    <Browser> being Chrome, Safari, Firefox, etc.

    0 讨论(0)
  • 2021-02-14 23:55

    You can fix it by setting to 'false' this setting in the config file

    If not already done, generate a config file : jupyter notebook --generate-config

    Then update this : NotebookApp.use_redirect_file to False (defaulted as True) in ~/.jupyter/jupyter_notebook_config.py

    (from https://jupyter-notebook.readthedocs.io/en/stable/config.html)

    NotebookApp.use_redirect_fileBool

    Default: True

    Disable launching browser by redirect file For versions of notebook > 5.7.2, a security feature measure was added that prevented the authentication token used to launch the browser from being visible. This feature makes it difficult for other users on a multi-user system from running code in your Jupyter session as you.

    However, some environments (like Windows Subsystem for Linux (WSL) and Chromebooks), launching a browser using a redirect file can lead the browser failing to load. This is because of the difference in file structures/paths between the runtime and the browser. Disabling this setting to False will disable this behavior, allowing the browser to launch by using a URL and visible token (as before).

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