Skip to content

Instantly share code, notes, and snippets.

@lee-pai-long
Created January 20, 2016 14:24
Show Gist options
  • Save lee-pai-long/f5f4d4d49fb0a1de960f to your computer and use it in GitHub Desktop.
Save lee-pai-long/f5f4d4d49fb0a1de960f to your computer and use it in GitHub Desktop.

[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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment