The easiest, most convenient and flexible way to modify the default working path of Jupyter Notebook

foreword

Recently, I want to learn the basic algorithm of nlp. I downloaded some notebooks on GitHub, which can be opened with jupyter to learn.
As we all know, after jupyter is opened, the default working path is generally under the personal username folder of the C drive, which is not very convenient. Many times, you don't want to put all the notebook files in the default working path of jupyter, because the personal user name folder on the C drive will become larger and larger and appear bloated.

How to modify jupyter default working path

So how to modify the default working path of jupyter? Generally speaking, there are three methods widely spread on the Internet: 1) Open the cmd of Windows, enter jupyter notebook --generate-config in cmd, and modify #c.NotebookApp in the generated Jupyter_notebook_config.py .notebook_dir = '', change it to your own working path; 2) Find the shortcut created by Anaconda, right click —> Properties —> enter and modify the address of the starting location, and then click Apply to succeed; 3) Open Anaconda The etc file in the installation directory is like: D:\Anaconda3\etc\jupyter My installation directory is in D:\Anaconda3, and then open the jupyter_notebook_config.json file, add notebook_dir: custom path to it.

I have tried all the three methods widely rumored on the Internet. After the modification of method 1 and method 2, it is completely invalid; as for method 3, the config.json file was not found at all.

Of course, this is just the result of the author's environment, and it doesn't mean that all netizens will also fail.

The following is the author's environment:

win10系统
Miniconda3 py38_4.9.2 (Python 3.8.5 64-bit)
jupyter                      1.0.0

Simple, convenient and effective modification of jupyter default working path

If you want to change the default working path of jupyter frequently, the easiest way is to write a bat file (in the windows environment). For details, refer to the following code, where the default working path you want to modify is after cd:

@echo off
D:
cd D:/work/Project_I/nlp_learn/nlp-tutorial-main 
jupyter notebook

Click the bat file after modification, the running effect is:
insert image description here

Guess you like

Origin blog.csdn.net/weixin_42280271/article/details/128286518