Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install python 2.7.3 on CentOS
#!/bin/bash
# Source: http://toomuchdata.com/2012/06/25/how-to-install-python-2-7-3-on-centos-6-2/
yum -y groupinstall "Development tools"
yum -y install zlib-devel
yum -y install bzip2-devel openssl-devel ncurses-devel sqlite-devel mysql-devel
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2
if [ ! -f Python-2.7.3.tar.bz2 ] ;then
echo "Python-2.7.3.tar.bz2 not found"
exit 1
fi
tar xf Python-2.7.3.tar.bz2
cd Python-2.7.3
./configure --prefix=/usr/local/python2.7
make && make altinstall
/usr/local/python2.7/bin/python2.7 -V
ln -s /usr/local/python2.7/bin/python2.7 /usr/bin/python2.7
# set -o vi
wget --no-check-certificate http://pypi.python.org/packages/source/d/distribute/distribute-0.6.27.tar.gz
if [ ! -f distribute-0.6.27.tar.gz ] ;then
echo "distribute-0.6.27.tar.gz not found"
exit 1
fi
tar xf distribute-0.6.27.tar.gz
cd distribute-0.6.27
python2.7 setup.py install
if [ $? != 0 ] ; then
echo "distribute installation failed"
exit 1
fi
if [ -f /usr/local/python2.7/bin/easy_install-2.7 ] ;then
ln -s /usr/local/python2.7/bin/easy_install-2.7 /usr/bin/easy_install-2.7
else
echo "/usr/local/python2.7/bin/easy_install-2.7 not found"
exit 1
fi
/usr/local/python2.7/bin/easy_install-2.7 pip
/usr/local/python2.7/bin/easy_install-2.7 virtualenv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment