Building python from source on RHEL5, I've had some troubles. Python keeps not finding bz2, giving me the complaint:
Python build finished, but the necessary bits to build these modules were not found: _tkinter bsddb185 dl gdbm imageop sunaudiodev To find the necessary bits, look in setup.py in detect_modules() for the module's name. Failed to build these modules: _curses _curses_panel _bz2
I already BUILT bz2 and installed it with the right prefix. UG.
FINALLY I found the following hint. Turns out bz2 source compile / make doesn't make everything by default. It just makes the executables bzunzip2, etc., but not the all-important (to python compiling) libbz2_so.
There's a file there, though, you just have to invoke it!
$ cd ~/temp $ wget http://www.bzip.org/1.0.5/bzip2-1.0.5.tar.gz $ tar zxvf bzip2-1.0.5.tar.gz $ cd bzip2-1.0.5next, TWO MAKES. INVOKE BOTH MAKEFILES:
$ make -f Makefile-libbz2_so $ makethen, it works. NOTE: for the rest of the instructions, I like the page: http://rajaseelan.com/2012/01/28/installing-python-2-dot-7-2-on-centos-5-dot-2/