Installing Python 2.7 on older RHEL-based package installations

Steps for installing Python 2.7 on older distributions such as CentOS 6.5.

How to install Python 2.7 on older distributions such as CentOS 6.5.

Note: DataStax Enterprise 5.0 does not support all older RHEL-based platforms. See Supported platforms.

Procedure

  1. Verify your Python version:
    python -V
  2. If Python is not version 2.7.x, install it from the operating system software collection:
    • For RHEL Software Collections:
      $ sudo yum update ## optional
      $ sudo yum install scl-utils
      $ sudo yum-config-manager --enable rhel-server-rhscl-6-rpms
      $ sudo yum install python27
      $ sudo scl enable python27 bash
      $ export PYTHONPATH="/usr/lib/python2.7/site-packages/":$PYTHONPATH
    • For CentOS Software Collections ( SCL ) Repository:
      $ sudo yum update ## optional
      $ sudo yum install scl-utils
      $ sudo yum install centos-release-scl-rh
      $ sudo yum install python27
      $ sudo scl enable python27 bash
      $ export PYTHONPATH="/usr/lib/python2.7/site-packages/":$PYTHONPATH
  3. Verify the update:
    python -V
    
    Python 2.7.8
  4. After logging out or restarting, you must enable python 2.7 and set the export command:
    $ sudo scl enable python27 bash
    $ export PYTHONPATH="/usr/lib/python2.7/site-packages/":$PYTHONPATH
    Enabling Python 2.7 in .bash_profile or .bashrc causes the machine to hang because CentOS 6 relies on Python 2.6 for Yum.