How to Change Jupyter Notebook Default Directory in Anaconda (Windows Guide)
Setting up a custom folder for saving Jupyter Notebooks in Anaconda is crucial for efficient project management, especially if you use multiple drives on Windows.
By default, Jupyter Notebooks open in the C: drive. However, you can easily change the default directory to your preferred folder, such as a Python Projects folder in your E: drive. This not only keeps your work organized but also improves workflow efficiency.
In this guide, you’ll learn step-by-step how to change the Jupyter Notebook default directory in Anaconda.
Why Change the Jupyter Notebook Directory?
Changing the default Jupyter Notebook directory offers several advantages:
📂 Organize projects on your preferred drive
🔒 Save notebooks away from system files for easier backup
👨💻 Enable team collaboration on shared drives
⚡ Improve workflow efficiency for data scientists and developers
Step 1 – Generate Jupyter Notebook Configuration File
- Open Anaconda Prompt.
- Enter the following command:
jupyter notebook --generate-config
✔ This will create a file named jupyter_notebook_config.py in your profile directory, typically located at:
C:\Users\<your username>\.jupyter\
Step 2 – Edit the Configuration File to Set Default Directory
Navigate to: C:\Users\<your username>\.jupyter\
Open jupyter_notebook_config.py with Notepad or another text editor.
Search for this line (use Ctrl + F):
#c.NotebookApp.notebook_dir = ''
Uncomment the line by removing #, then set the path to your desired folder. Example:
c.NotebookApp.notebook_dir = 'E:/MyProjects'
⚠ Important: Use forward slashes (/) or double backslashes (\\) for Windows compatibility.
- Save the file.
Step 3 – Launch Jupyter Notebook from the New Default Folder
- Open Anaconda Prompt.
- Start Jupyter Notebook with the command:
jupyter notebook
Now, Jupyter Notebook will launch directly from your specified folder (e.g., E:/MyProjects), allowing you to save and access notebooks in your preferred directory.
✅ FAQs about Jupyter Notebook Default Directory
Q1: Can I set multiple default directories in Jupyter Notebook?
No, Jupyter Notebook supports only one default startup directory. However, you can navigate manually to other folders after launching.
Q2: Will changing the default directory affect existing notebooks?
No, existing notebooks will remain in their original location. Only new sessions start in the updated folder.
Q3: Can I set the Jupyter Notebook default directory on other drives (D, F, etc.)?
Yes, you can specify any drive or folder path, such as D:/DataScienceProjects.
Q4: What if my custom path has spaces in it?
Use quotes around the path, for example:
c.NotebookApp.notebook_dir = "E:/My Projects"
Q5: Do I need admin rights to change the Jupyter Notebook directory?
No, admin rights are not required. You only need permission to access the folder you want to use.
Q6: How do I reset Jupyter Notebook back to the default C drive?
Simply comment out or delete the custom directory line in jupyter_notebook_config.py.
Changing the Jupyter Notebook default directory in Anaconda is a simple yet powerful way to streamline your workflow. By setting a custom folder (such as an E:/MyProjects directory), you can keep projects organized, improve efficiency, and collaborate more effectively.