These lessons learned pertain to Python 2.6.1 on Redhat Enterprise Linux RHEL 4 / CentOS 4.

How to build Python 2.6.1 RPMs

# This is a required dependency
sudo yum install sqlite-devel
# This provides which isn't listed as a depenency but is required nonetheless 
# (More info on this in this FAQ for 2.4 :
sudo yum install tcl-devel
cd /usr/src/redhat/SOURCES/
wget ""
cd /usr/src/redhat/SPECS
bunzip2 -c /usr/src/redhat/SOURCES/Python-2.6.1.tar.bz2 | tar -vxO Python-2.6.1/Misc/RPM/python-2.6.spec > python-2.6.spec
# patch the spec file ( )
wget ""
patch python-2.6.spec python-2.6.1.spec.diff
# build
rpmbuild -bb --clean python-2.6.spec

How to install setuptools via RPM

I’m running RHEL 4 and the easiest way to install setuptools is to use the EPEL repositories existing RPM

Or rebuild the source RPM as follows :

# get setuptools
wget ""
sudo rpm -ivh /usr/src/redhat/RPMS/i386/python2.6-tools-2.6.1-1pydotorg.i386.rpm
sudo rpm -ivh /usr/src/redhat/RPMS/i386/python2.6-devel-2.6.1-1pydotorg.i386.rpm
# patch 
wget ""
sudo mv python-distutils-rpm-8.patch /usr/lib/python2.6/distutils/command/
sudo patch /usr/lib/python2.6/distutils/command/ /usr/lib/python2.6/distutils/command/
# build
rpmbuild --rebuild setuptools-0.6c9-1.src.rpm