Jupyter Tutorial on Setting IPython as Default Python Environment

different environment variables influence python’s behaviour. pythonstartup environment variable is assigned to a python script. as an effect, this script gets executed before python prompt appears. this is useful if certain modules are to be loaded by default every time a new python session starts.

the following script (start.py) imports ipython module and executes start_ipython() function to replace default python shell with prompt (>>>) by ipython shell when python executable is invoked.

import os, ipython
os.environ['pythonstartup'] = ''
ipython.start_ipython()
raise systemexit

assuming that this file is stored in python’s installation directory (c:\python36), set pythonstartup environment variable and start python from command line. then ipython shell appears as shown below −

python’s installation directory

note that the environment variable can be permanently set using system properties dialog in windows and using export command on linux.