Jupyter Notebook | Change the default directory and browser

Every time you install jupyter notebook, the default directory and default browser will be changed. Here are the steps~

jupyter notebook

Installing jupyter notebook is very simple, as long as you install python cmd, pip install jupyter notebookyou can do it in the middle . If you have downloaded anaconda, conda install jupyter notebookyou can download it directly using the visual interface.
Open the notebook cmdand type in jupyter notebook.

Change the default browser

If you find that the browser opened by jupyter notebook is not what you are used to, you can change the default browser to open. Change to firefox browser here.

Get configuration file location

First find jupyter_notebook_config.pythe location of the configuration file . Just use and cmdrun jupyter notebook --generate-config, as shown in the figure.
Insert picture description here

After finding the corresponding file, open it and open it with Notepad.
Insert picture description here

Get the browser installation directory

The browser installation directory generally refers to the directory selected when the browser was originally installed. That is ***.exe, the location of the file. Right-click the browser icon, select properties, and open 目标the location in which is the browser installation directory.
Insert picture description here

Change the default browser

Ctrl+FFind c.NotebookApp.browser, as shown in the figure.
Insert picture description here
Then replace it with the following statement block:

import webbrowser

webbrowser.register("firefox",None,webbrowser.GenericBrowser(u"C:\\Program Files\\Mozilla Firefox\\firefox.exe"))

c.NotebookApp.browser = 'firefox'

If it is a Chrome browser, it is as follows:

import webbrowser

webbrowser.register("chrome",None,webbrowser.GenericBrowser(u"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"))

c.NotebookApp.browser = 'chrome'

Other analogy.
Note: There are three places to change! careful!
It must be noted that the "" in the directory should be replaced with "\"!!! The
blogger here sets the Firefox browser as follows.

Insert picture description here

Then Ctrl+Ssave, restart the notebook, and open it again.

Change the default directory

After opening, jupyter notebook generally opens the user folder by default, so you need to open the specified directory by default and you can also set it. Similar to changing the default browser, find the configuration file first.

Get configuration file location

First find jupyter_notebook_config.pythe location of the configuration file . Just use and cmdrun jupyter notebook --generate-config, as shown in the figure.
Insert picture description here

After finding the corresponding file, open it and open it with Notepad.
Insert picture description here

Change the default directory

Similarly, Ctrl+Ffind c.NotebookApp.notebook_dir, as shown in the figure.
Insert picture description here
Then ' 'just fill in the designated default directory, remember to remove the previous comment #.
There is no need to \replace it with \\~ the
blogger here is set as follows.
Insert picture description here
Then Ctrl+Ssave, restart the notebook, and open it again.

Guess you like

Origin blog.csdn.net/weixin_43360896/article/details/112972377