By default, CentOS 6 comes with Python 2.6. This manual is only for those, who want a newer version of the software.

You can check which version is currently installed by opening the terminal and executing the command python –version.

How to install Python on CentOS 6

Execution of each of these commands can take up to several minutes.

  1. Update all packages with
    yum update
  2. Install zlib-devel module:
    yum install zlib-devel
  3. Install openssl-devel module:
    yum install openssl-devel
  4. Check the compiler version:
    gcc –v
  5. If you need to, install the compiler:
    yum install gcc
  6. Download Python from the official source:
    cd /tmp/
    wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz
  7. Unpack it and go to the unpacked folder:
    tar xfp Python-2.7.9.tgz
    cd Python-2.7.9
  8. Check the dependencies and execute makefile:
    ./configure
    cat Makefile | grep prefix
    ./configure -h | grep prefix
  9. Create the installation package:
    make
  10. Install it:
    make install

After you are done, Python will be updated to the latest version.