next up previous
Next: Embedding IPython in other Up: IPython An enhanced Interactive Previous: Customization

Using IPython as your default Python environment.

Python honors the environment variable PYTHONSTARTUP and will execute at startup the file referenced by this variable. If you put at the end of this file the following two lines of code:

import IPython 
IPython.Shell.IPShell().mainloop(sys_exit=1)

then IPython will be your working environment anytime you start Python. The sys_exit=1 is needed to have IPython issue a call to sys.exit() when it finishes, otherwise you'll be back at the normal Python '>>>' prompt4.

This is probably useful to developers who manage multiple Python versions and don't want to have correspondingly multiple IPython versions. Note that in this mode, there is no way to pass IPython any command-line options, as those are trapped first by Python itself.



Fernando Perez 2003-08-25