After installing Jupyter notebook, I opened it and found that the default file storage location is on the C drive, and there are a lot of files, which makes people look very uncomfortable, it is inconvenient to organize files by myself, and jupyter cannot automatically jump to the browser. After looking for tutorials on the Internet, I compiled the following solutions. Record the problems you have encountered, and avoid pitfalls for the latecomers by the way!
1. Modify the default working path of Jupyter Notebook in Anaconda
1. Open Anaconda Prompt, and enter jupyter notebook --generate-config to find the path of jupyter_notebook_config.py, as shown in the figure below, mine is
C:\Users\user.jupyter\jupyter_notebook_config.py
2. The path obtained in step 1 is C :\Users\user.jupyter Find the jupyter_notebook_config.py file and open it, find the variable c.NotebookApp.notebook_dir, delete the "#" in front of this line, and assign the path you want to this variable. For example, I want to put The file exists in D:\softfiles\jupyterNotebook.
So change the original #c.NotebookApp.notebook_dir = ''
to c.NotebookApp.notebook_dir = 'D:\softfiles\jupyterNotebook'
as shown below:
3. Find the shortcut of Jupyter Notebook, right-click to open properties, and delete "%USERPROFILE%" at the end of "Target", without modifying other content.
4. Open the Jupyter notebook, and the running window will pop up. You can see that the path has been modified successfully! Folders in the browser correspond to local folders.
2. Solve the Jupyter Notebook in Anaconda, the browser cannot automatically jump
1) First open the jupyter_notebook_config.py file mentioned in the above steps, search for c.NotebookApp.password
and add the following command below the statement
import webbrowser
webbrowser.register('msedge',None,webbrowser.GenericBrowser(u'C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe'))
c.NotebookApp.browser = 'msedge'
2) Graphic version of the operation
Press the ctrl and F keys at the same time to search
Add three lines of commands, I use the browser that comes with Microsoft, you can also set other browsers, the method is the same.
In this way, reopening the jupyter notebook will allow the browser to automatically jump to the file directory you want!