Centos 6.* comes with Python 2.6, but we can't just replace it with v2.7 because it's used by the OS internally (apparently) so you will need to install v2.7 (or 3.x, for that matter) along with it. Fortunately, CentOS made this quite painless with their Software Collections Repository
sudo yum update # update yum
sudo yum install centos-release-scl # install SCL
sudo yum install python27 # install Python 2.7
To use it, you essentially spawn another shell (or script) while enabling the newer version of Python: