This is the easier method of the two for installing Python on your machine. Here, we simply add a repository that has the pre-compiled version ready for us to install. In this case, we are adding the Inline with Upstream Stable repository, a community project whose goal is to bring new versions of software to RHEL-based systems.

Step 1: Open a Terminal and add the repository to your Yum install.

sudo yum install -y

Step 2: Update Yum to finish adding the repository.

sudo yum update

Step 3: Download and install Python.
This will not only install Python – but it will also install pip to help you with installing add-ons.

sudo yum install -y python36u python36u-libs python36u-devel python36u-pip

Once these commands are executed, simply check if the correct version of Python has been installed by executing the following command:

python3.6 -V

You have now finished installing Python 3.6.4 on your CentOS 7 machine, as well as installing a native Python package management tool called pip.