There is a way to do it. Store the file in ~/.pystartup
# Add auto-completion and a stored history file of commands to your Python
# interactive interpreter. Requires Python 2.0+, readline. Autocomplete is
# bound to the Esc key by default (you can change it - see readline docs).
# Store the file in ~/.pystartup, and set an environment variable to point
# to it: "export PYTHONSTARTUP=/home/user/.pystartup" in bash.
# Note that PYTHONSTARTUP does *not* expand "~", so you have to put in the
# full path to your home directory.
historyPath = os.path.expanduser("~/.pyhistory")
del os, atexit, readline, rlcompleter, save_history, historyPath
You can also add this to get autocomplete for free:
Please note that this will only work on *nix systems. As readline is only available in Unix platform.