Seven steps to compile Python3.5.0 from source

After a minimal install of centos7, you would noticed that your version of Python would be may be 2.7.5 which may not be compatible with other applications you are actually using. To be update to the latest version, one of the possibilities is to compile your own Python from Source.

python

Here are the steps that you can follow to compile your own Python. At the time, i am writing this article the latest version is Python-3.5.0. You can refer to this link for future versions.

1.Download the prerequisites. I would also recommend an update before downloading the prerequisites.

yum update -y && yum install yum-utils make wget

2.To be able to compile your Python, you will need to download some requirements which will facilitate the compilation tasks

yum-builddep python

3.Download the Python package

wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz

4.Untar your Python Package

tar xvzf Python-3.5.0.tgz

5. Get into the Package and fire the following commands

./configure
make

6.If the make process is successful, you can now start the installation with the following command

make install

7.Python-2.7 is usually the default version. You will need to specify your OS to run with the new version.

alias python='/usr/local/bin/python-3.5'

We now have the python-3.5 installed and ready for use.