Installing Python on CentOS 6 - a big pain

Benedict Verheyen benedict.verheyen at
Fri Jan 20 04:39:33 EST 2012

On 19/01/2012 5:36, Steven D'Aprano wrote:
> On Wed, 18 Jan 2012 19:10:43 -0800, alex23 wrote:
> download the tar ball
> extract the contents of the file
> cd into the source directory
> run ./configure
> run make
> optionally run make test
> run sudo make altinstall
> As a total n00b who'd never used make before, it took me 25 minutes 
> effort on my first attempt, including reading the entire README file 
> (twice!). Now I have the whole process down to about 30 seconds effort, 
> and six minutes elapsed time, on my laptop.

My first attempt to compile it on Debian took some extra steps,
as Python didn't find the ncurses and and readline libs.
But it was still easy to figure out how to build and install (locally) all
the necessary packages.
I leave the system installed python alone, and install the python version
I built in $HOME/usr/local so I can later use this in a virtualenv.

These are part of my notes from a while back so version might not be
up to date anymore.

1. Compile zlib
tar xzvf zlib-1.2.5.tar.gz
cd zlib-1.2.5
./configure --64 --prefix=$HOME/usr/local
make install

2. Compile readline
tar xzvf readline-6.1.tar.gz
./configure --enable-shared --prefix=$HOME/usr/local
make install

3. Compile ncurses
tar xzvf  ncurses-5.7
./configure --with-shared --enable-termcap --prefix=$HOME/usr/local
make install

4. Install Python from source
tar xzvf Python-2.7.2.gz
cd Python-2.7.2
export LDFLAGS="-L$HOME/usr/local"
./configure --enable-shared --prefix=$HOME/usr/local
make install

If i need to install a new version of Python, as I happen to have done today,
I only need to do step 4. Which is maybe 5 minutes of work.


More information about the Python-list mailing list