Because each and every process in the system has its own current directory. So what happens here :
- you have an interactive shell with a current directory
- you start an interactive python shell : it receives the current directory of its parent
- you change current directory for current python shell only
- you use it until you close python
- you close python and return in your interactive shell in original directory
- you start python again always in original directory
Alternatively, as it looks that you are using Windows, you can start a Python shell from Windows explorer. Things are slightly different here :
- if you directly click on the
Python.exe
file in its own directory, Windows explorer starts the program in this directory
- if you use a shortcut to start the Python shell (or startup menu that only consist in shortcuts), the shortcut sets an initial directory. It it is not defined in shortcut properties, it is the directory containing the
Python.exe
file.
But here again, when you close the Python shell, its current dir is lost and next invocation will still follow above rules.
So what to do if you want to change the initial current directory :
the batch method (could be used on any system) : create a batch file that first change directory and then start Python interpreter with its full path (adapt paths to your actual needs)
cd e:\Python
c:\python\python.exe
use a shortcut and configure start directory in shortcut properties