Solving the build error Python.h: No such file or directory on Ubuntu

I was struggling due to this problem for couple of days and got the solution just now , I  thought to share it
with you all; as I don’t want anyone else to land up in trouble and waste so much time as I had to.

I use Hardy(Ubuntu) and was trying to build subvertpy  from source as the package was not available for same.

Why this error occurs

This problem occurs due to absence of Python development headers as many python modules have dependency on  Python development headers to compile.

Solution

Solutions are usually simple to such problems this one is no exception, just need to install development headers using package manager; open the terminal and issue the following commands

sudo apt-cache search python

and select the package that matches your installation as in my case it is python2.5-dev; issue the following command to install it

sudo apt-get install python2.5-dev

This will install development headers in /usr/include/python2.5 and now you can build your python module successfully.