Step 1: Prerequisites

The first step in Pythonís installation is running a configure script which snoops around your system, looking for packages that it needs to build various capabilities and extensions with. Having these packages installed before running configure makes sure it finds them.
Here are some packages that have to be installed to have various aspects of Python functioning:

sudo apt-get install libreadline-dev
sudo apt-get install libsqlite3-dev
sudo apt-get install libbz2-dev
sudo apt-get install libssl-dev

Step 2: Download and build Python

"Source distribution" is a direct link to the tarball. Download it. Unzip the tarball, and from the root of the created directory
make -j

I found that the default configure settings work fine for Ubuntu 10.04 and thereís no real need to specify extra --with flags.
You can now check that Python was correctly built by executing ./python and falling into its interactive terminal. If you want, you can also execute the Python test-suite with make test, though it may take a long time to run [~10 minutes on a relatively fast machine].

Step 3: Install

In the same directory, run:
sudo make install

This installs Python into /usr/local/bin. Depending on the configuration of your system, you may want to add symlinks to the newly created /usr/local/bin/python2.7 in /usr/bin/ as well.

Thatís it, you now have Python 2.7 installed.

Step 4: Install some essential first modules

Python has a powerful packaging & installation machinery for its modules, but it doesnít come pre-installed with Python itself.
So itís a good idea to install setuptools , followed by pip.

From now, pip can be used to install other Python modules very conveniently. For example, all you need to have the IPython shell installed is:
sudo pip install ipython

Keywords:Installing Python 2.7 on Ubuntu, Ubuntu 10.04 machines ,version 2.7. , documentation,Prerequisites,Pythonís installation , packages, capabilities , extensions ,Python functioning,Download , build Python,Source distribution, Python-2.7.2 , default configure , interactive terminal, Python test-suite ,sudo make install, installs Python , Python 2.7 install, first modules, powerful packaging,installation machinery ,modules,install setuptools, pip, Python modules,IPython shell install,sudo pip install ipython