Change Jupyter Notebook Default Directory

本文介绍了三种修改Jupyter Notebook启动默认目录的方法:通过配置文件、属性设置和Anaconda配置。这些步骤帮助用户轻松地将默认工作目录更改为所需的路径。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Change Jupyter Notebook Default Directory

There are three way to change the default (i.e., start-up) directory of jupyter notebook.

Solution #1

1.Use command line (aka, cmd), run the following command: this will generate a config file (jupyter_notebook_config.py), in your working location (C:\Users[Your Username].jupyter).

jupyter notebook --generate-config

2.Goto that location (C:\Users[Your Username].jupyter) and edit file jupyter_notebook_config.py as follow.

Find line:

## The directory to use for notebooks and kernels.
#c.NotebookApp.notebook_dir = ''

3.Delete the “#” and type your default directory inside the ”. (Make sure the directory is exist, or it may causes some troubles)
For example:

## The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = 'E:\Default Jupyter Dir\'

Solution #2

1.Find the Jupyter Notebook execute file.

2.Right click the file

3.Find “properties” tab and click it; this will lead you to the “Jupyter Notebook Properties”

4.Check the pop-up window, and you should see “Start in” property.

5.Change the directory to your default directory, e.g., ‘E:\Default Jupyter Dir\’

Solution #3

This solution is based on Anaconda, since Jupyter Notebook load the profile from Anaconda.

You may see the following information from properties window if you had gone through Solution #2.

"Target: D:\Anaconda3\python.exe d:\Anaconda3\cwp.py d:\Anaconda3 "d:/Anaconda3/python.exe" "d:/Anaconda3/Scripts/jupyter-notebook-script.py" %USERPROFILE%"

1.Goto the Anaconda installed location.

2.Find the ‘etc’ directory in Anaconda.

3.Open file ‘jupyter_notebook_config.json’

4.Add your default directory to the ‘notebook_dir’.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值