OK, so I know this is an old one, but one I felt is worth mentioning none the less.
Ubuntu does not, by default, have the PYTHONSTARTUP variable set – furthermore, the pythonstartup file does not exist initially either. Fortunately, both of these ‘issues’ are easily resolved.
you:~$ gedit .pythonstartup
Now to fill in your pythonstartup config file:
#Bind ‘TAB’ to complete
#Set history file – ~.pythonhistory
histfile = os.path.join(os.environ[‘HOME’], ‘.pythonhistory’)
#Attempt read of histfile
#Write history file at shell exit
del os, histfile, readline, rlcompleter
Now set your PYTHONSTARTUP var:
you:~$ export PYTHONSTARTUP=~/.pythonstartup
Now you are good to enter the Python Interactive Shell with CODE COMPLETION AND HISTORY!