Every time you install jupyter notebook, the default directory and default browser will be changed. Here are the steps~
Jupyter Notebook | Change the default directory and browser
jupyter notebook
Installing jupyter notebook is very simple, as long as you install python cmd
, pip install jupyter notebook
you can do it in the middle . If you have downloaded anaconda, conda install jupyter notebook
you can download it directly using the visual interface.
Open the notebook cmd
and 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.py
the location of the configuration file . Just use and cmd
run jupyter notebook --generate-config
, as shown in the figure.
After finding the corresponding file, open it and open it with Notepad.
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.
Change the default browser
Ctrl+F
Find c.NotebookApp.browser
, as shown in the figure.
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.
Then Ctrl+S
save, 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.py
the location of the configuration file . Just use and cmd
run jupyter notebook --generate-config
, as shown in the figure.
After finding the corresponding file, open it and open it with Notepad.
Change the default directory
Similarly, Ctrl+F
find c.NotebookApp.notebook_dir
, as shown in the figure.
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.
Then Ctrl+S
save, restart the notebook, and open it again.