2019.12.16(pm): How to Change Jupyter notebook Initial Path Settings

When using the Jupyter notebook, the initial path is often C: \ Users \ USERNAME. In this case, It is difficult to manage python code, and C drives become a mess. So users run Jupyter notebook, go to Desktop, create a new folder and work on it. Because doing this repetitive task every time is inefficient, today I’m going to look at how to set up the initial execution path for Jupyter notebook.

First, launch the anaconda prompt window. At this time, you cannot change the initial path for each virtual environment you want, but it applies to the entire virtual environment including the base. Run the following command:

jupyter notebook --generate-config

The anaconda prompt will tell you where the jupyter_notebook_config.py file was created. Copy that path and paste it into the address bar of File Explorer. Then open the jupyter_notebook_config.py file as a txt file. Use ctrl + F to search dir and find the following code:

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

Delete the comment # and insert the absolute path between the ‘ ‘ s. Note that you should not use \, but /.

## The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = 'C:/Users/USERNANE/Desktop/folder_name'

Then you are done 😀


Comments

6 responses to “2019.12.16(pm): How to Change Jupyter notebook Initial Path Settings”

  1. It’s going to be finish of mine day, but before
    finish I am reading this enormous article to improve my know-how.

  2. Good day I am so glad I found your website, I really found you by accident,
    while I was researching on Yahoo for something else, Anyhow
    I am here now and would just like to say many thanks for a marvelous post and a all round exciting blog (I
    also love the theme/design), I don’t have time to go through
    it all at the moment but I have bookmarked it and also added
    in your RSS feeds, so when I have time I will be back to read a lot more,
    Please do keep up the fantastic work.

  3. Hmm it seems like your site ate my first comment (it was super long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog.
    I too am an aspiring blog blogger but I’m still new to everything.

    Do you have any points for newbie blog writers?
    I’d really appreciate it.

    1. Thank you. If you have any question, send the contact mail.

  4. First of all I want to say superb blog! I had a
    quick question which I’d like to ask if you do not mind.

    I was curious to find out how you center yourself and clear
    your head before writing. I have had a difficult time clearing my thoughts in getting my thoughts out there.
    I truly do take pleasure in writing but it just seems
    like the first 10 to 15 minutes tend to be wasted just trying to figure out how to begin. Any ideas
    or tips? Kudos!

    1. You had better read as many books as you can.

Leave a Reply