Installing the latest version of Python on Centos 6.5

The latest version of Python as of today is 3.4.2. To install the latest python version, first install the required packages:

yum install wget gcc openssl-devel httpd sqlite-devel mysql-devel -y

Now you can download and install python itself:

wget https://www.python.org/ftp/python/3.4.2/Python-3.4.2.tgz  
tar -xf Python-3.4.2.tgz  
cd Python-3.4.2  
./configure -enable-shared  
make  
make altinstall

You’re good if, after an endless stream of characters, you see this message:

Ignoring indexes: https://pypi.python.org/simple/  
Downloading/unpacking setuptools  
Downloading/unpacking pip  
Installing collected packages: setuptools, pip  
Successfully installed setuptools pip

After this the binaries will be in /usr/local/bin/. Check like this:

ls -la /usr/local/bin/p*

After this you can use:

pip3.4  
python3.4  
pydoc3.4  
pyvenv-3.4

Create the necessary symlinks:

ln -s /usr/local/lib/libpython3.so /usr/lib64/libpython3.4.so  
ln -s /usr/local/lib/libpython3.4m.so.1.0 /usr/lib64/libpython3.4m.so.1.0  
cp /usr/local/lib/libpython3.4m.so /usr/lib/

Now check the installed version:

python3.4 -version

You get the output you’re after:

Python 3.4.2