SoFunction
Updated on 2024-11-16

Configure jupyter notebook full steps, change the default path, jupyter is not a problem!

The first time you open the jupyter notebook that comes with anaconda, the default path is C:\Users\Admin (your own user name), you need to replace it with your own working path.

Although there are many such articles on the internet, most of them only tell part of the story and you need to go through a lot of articles to understand them, I put together all the steps that I need to pay attention to, and I know which step I'm missing by checking for errors.

Let's take a look at the results of opening jupyter notebook in three different ways after the change

1, from the lower left corner of the program shortcut start

从程序快捷启动

2. Start from cmd

3. Launch the program from the scripts folder installed on the D drive

Let's take a step-by-step look at the full steps to configure jupyter notebook

1, create a new jupyter-notebook folder

The purpose of the operation is that this is the folder that will be opened when you start jupyter notebook in the future.

My operation:I created a new folder "jupyter-notebook" in the E drive with the path E:\jupyter-notebook.

2, generate jupyter_notebook_config.py file

process: open the command prompt cmd → type "jupyter notebook --generate-config" (note the absence of quotation marks) to generate the file, open the C disk under the jupyter folder to see whether the generation is successful.

My operation:There is only one migrated file under C:\Users\ before it was generated.

3、Continue to step 2, modify the config path

Open the jupyter_notebook_config.py file that was just generated

Find this line #.notebook_dir = ' '

Add the path generated in step 1.

.notebook_dir = '(own path)'

Be sure to remove the leading #

My operation:Change line 214 #.notebook_dir = ' ' to .notebook_dir = 'E:\jupyter-notebook'.

4. Add environment variables

Operation process (win10 for example): this computer → right-click → Properties → Change Settings → Advanced → Environment Variables → double-click path → New → will install anaconda path under the Scripts path to copy over (this is the path.

My operation: For example, mine is the path D:\install\anaconda\Scripts

5. Modify the shortcut to Jupyter Notebook in the start menu.

Operation procedure (take Win10 as an example): Program → Anaconda → Jupyter Notebook → Right-click → Properties → Shortcuts → Remove "%USERPROFILE%" after the "Target" item.

My Operation

Well, against the above 5 steps, check their own path is configured correctly, is no longer popped up "Jupyter is not an internal or external command or runnable program or batch" prompt.

summarize

The above is a personal experience, I hope it can give you a reference, and I hope you can support me more.