Update: The method mentioned below no longer works because the website hosting it is offline.
If you’ve tried to compile Node.js on a server running CentOS then you probably ran into show-stopping syntax errors. Unfortunately, CentOS still ships with Python 2.4 by default even though its release was almost 8 years ago. To compile Node.js from the source you need Python 2.6 or higher.
A repository-based solution is your best alternative to finding a safe, headache-free way of updating Python. The source link is amazingly easy to set up and you get the added benefit of updating Node.js in the same manner as all your other installed packages.
On CentOS:
wget http://nodejs.tchol.org/repocfg/el/nodejs-stable-release.noarch.rpm
yum localinstall --nogpgcheck nodejs-stable-release.noarch.rpm
yum install nodejs-compat-symlinks npm