The built-in version with RedHat 6.2 is python 2.6.6. On top of the OS, I installed python 2.7.3. However, the newly installed version has an issue: The python interpreter shell does not support recall of the last command. The following are the steps to fix it:
1) In your ~/.bashrc, add variable "PYTHONSTARTUP":
export PYTHONSTARTUP=$HOME/.pythonstartup
2) Put your python code in $HOME/.pythonstartup, like:
import rlcompleter
import readline
readline.parse_and_bind("tab: complete")
3) Please read python man page for more infomation:
$ man python
Note: you may need to install python module (such as readline-6.2.4.1) or
ncurses-devel-5 from (RPM) Package Manager GUI.
====== More detailed approch ==============
http://stackoverflow.com/questions/4289937/-
-how-to-repeat-last-command-in-python-interpreter-shell
===================================
1) PYTHONSTARTUP environment variable is set in file .pythonstartup:
# python startup file
import readline
import rlcompleter
import atexit
import os
# tab completion
readline.parse_and_bind('tab: complete')
# history file
histfile = os.path.join(os.environ['HOME'], '.pythonhistory')
try:
readline.read_history_file(histfile)
except IOError:
pass
atexit.register(readline.write_history_file, histfile)
del os, histfile, readline, rlcompleter
2) You will need to have the modules readline, rlcompleter to enable this.
Check out the info on this at : http://docs.python.org/using/cmdline.html#envvar-PYTHONSTARTUP.
or
How to configure and use python interpreter
3) Modules required:
http://docs.python.org/library/readline.html
http://docs.python.org/library/rlcompleter.html