Thursday, November 14, 2013

How to build Python deb package from source

You need a newer python version that is not available with the Debian package management system. You can compile it from source and install but that usually takes a lot of time. It would be better to build a deb instead and install it on as many machines as you need. You can use checkinstall for this.
apt-get install checkinstall
The instruction how to compile python from source is here. Once you compiled python here is a simple command that does the rest for you:
checkinstall -y --pkgname=python2.7
Once it finishes you will get a deb file in the current directory. You can install it this way:
dpkg -i python2.7_2.7.6-1_i386.deb
Here is how to remove it:
apt-get remove --purge python2.7
Note, packages built with checkinstall are not updated by OS package management system, thus updates need to be provided manually.