What is the best way to upgrade to Python 2.6 from the default Python
2.4.
I've read these horror stories online and don't want to break yum.
Hi. At least there are 2 ways that I have tried and work.
The first: yum install gcc tcl tk sqlite-devel readline-devel gdbm-devel yum install tkinter ncurses-devel libdbi-devel tk-devel zlib-devel yum install openssl-devel bzip2-devel cd /opt # Python 2.7 so django and mod_wsgi work. wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz tar -xzvf Python-2.7.3.tgz ./configure
make
make altinstall prefix=/opt/python2.7.3 cd /opt # Use a link for easier administration if you need to upgrade python2.7 later. ln -s /opt/python2.7.3 /opt/python2.7 # Add this alias to your /etc/bashrc file for all users or your ~/.bashrc file for yourself. alias python2.7='/opt/python2.7/bin/python2.7' make altinstall will install the new Python as Python2.7; it will not collide with your default Python (2.4.x in CentOS 5.x, 2.6.6 in CentOS 6.2). You run it using "python2.7" instead of "python".
The second uses virtualenv as environment manager ( http://code.activestate.com/pypm/virtualenv/). I use it for a particular application, again no conflict with Python 2.4 under CentOS 5.6/7/8, or Python 2.6 in CentOS 6.2. These are the versions I have tried.