Changing default home directory for Python to start in a different directory
Question: Every time I start iPython, the first thing I **always** immediately change
the directory from the default directory, and I would like to know of a way to
edit this default starting directory.

Currently, iPython starts in the following directory:

    
    
    In [2]:  os.getcwd()
    Out[2]: 'C:\\Users\\Curtis\\Documents\\Python Scripts'
    

And the first thing I always do is:

    
    
    os.chdir('D:')
    

Once in the D: drive, I then use `cd` to navigate my various files and
folders.

There must be a way to change the default directory that python starts in so I
don't have to do this every time I start iPython.

One thing to note is that I cannot change where python is installed (if that
would be an option).


Answer: Try this:

  1. set PYTHONSTARTUP variable to a desired script. Example:"c:\startup.py"
  2. With in startup.py add these lines:
    
        import os
    
    os.chdir('yourdirectory') #example os.chdir("D:\\")
    

