lee-pai-long
1/20/2016 - 2:24 PM

install-python-3-on-centos-5.md

[Centos 5] Install python 3

Install requirements

$ [sudo] yum install \
> openssl-devel \
> bzip2-devel \
> expat-devel \
> gdbm-devel \
> readline-devel \
> sqlite-devel \
> gcc

Download python 3 tarball from official website***

$ wget --no-check-certificate \
> https://www.python.org/ftp/python/3.4.1/Python-3.4.1.tgz

Extract files

$ tar xvzf Python-3.4.1.tgz

Move into the directory and Configure prefix

$ cd Python-3.4.1 && \
> [sudo] ./configure --prefix=/opt/python3

Compile as alternative install

$ [sudo] make && \
> [sudo] make altinstall

you don't want to overwrite the python executable (safer, at least on some distros yum needs python to be 2.x)

Create a symbolic link for ease

$ sudo ln -s /opt/python3/bin/python3.4 /usr/bin/python3