I was having the Python 2.4.3 as default with my linux installation. To upgrade the Python to 2.7.3 I have followed the below instructions. It was simple. Just downloading, compiling and installing.
Notes: Make sure you have the linux development tools, gcc, zlib and similar things are already installed. Otherwise you can not perform the following tasks.
1) Download the Python.
2) Extract the zip file.
tar xf Python-2.7.3.tar.bz2
3) Enter inside the extracted directory.
4) Configuring the installation.
5) Make and install at the same time.
make && make altinstall
6) Add symbolic link in /usr/local/bin.
ln -s /usr/local/bin/python2.7 /usr/local/bin/python
That's it. Enjoy your upgraded Python!