Modify the default file location for Jupyter notebook
After installing Anaconda and Jupyter Notebook, open the Jupyter notebook will find that there are some folders displayed, but the exact location is not clear. To facilitate future file editing and saving, you need to modify the default file location of the Jupyter Notebook.
The detailed modification steps verified by practical operation are as follows:
1. Generate configuration files through the Anaconda Prompt command window: find and open the Anaconda Prompt in the start menu, type the following command, and then execute:
— generation-config.
2, open the configuration file generated in the previous step, it is generally in the following position: C:\Users\admin. Jupyter \jupyter \jupyter_notebook_config.py.
this file path is the default path for jupyter.
3, in the start menu to find jupyter notebook, and the previously generated configuration files with jupyter open, there are two ways to open:
(1) can be opened by dragging the configuration file to the notebook window;
(2) click on the Upload in the upper right corner of the notebook window, then find the configuration file and open it using the path described above.
Notebook_dir = ‘”
before the change: # c.notebookapp.notebook_dir =’
before the change: # c.notebookapp.notebook_dir = ‘
after the change: remove the # prefix and enter the default location in the single quotation marks, such as: c.notebookapp.notebook_dir =’ E:/Python_notebook ‘. Note: \ cannot be used in the Python file path, but /.
5, click save under file in the menu above the notebook window to save the changes, and use this saved file to overwrite the originally generated configuration file under C disk (this is very important, be sure to overwrite, otherwise the changes will not take effect), that is, to overwrite the configuration file at the following location:
C:\Users\admin.jupyter\ notebook_config.py.
6. From the Start menu, find Jupyter Notebook, right mouse button & GT; > Property & gt; > Shortcut & GT; > Target, delete the end “%USERPROFILE%/” in the box after the target.
After the above modification, finally finished. After restarting the Jupyter Notebook, the default file location has been changed to the desired location, which is: E:\Python_notebook.