Sunday, September 4, 2011

Python - Linux Installation

For Window, you can simply use the msi installer provided at

For Linux, you can do the following

yum install python

Usually, this way will install an older version of python. For example, CentOS will install python 2.4.3.

To install the latest version, you can use this script

# chmod +x
# ./

# Install necessary packages
yum -y install gcc gdbm-devel readline-devel ncurses-devel zlib-devel bzip2-develsqlite-devel db4-devel openssl-devel tk-devel bluez-libs-devel make

cd /var/tmp
tar xfz sqlite-amalgamation-3.7.3.tar.gz
cd sqlite-3.7.3/
make install

cd /var/tmp
tar xvfz Python-2.7.1.tgz
cd Python-2.7.1
./configure --prefix=/opt/python2.7.1 --with-threads --enable-shared
make install

touch /etc/
echo "/opt/python2.7.1/lib/" >> /etc/

ln -sf /opt/python2.7.1/bin/python /usr/bin/python2.7

cd /var/tmp
sh setuptools-0.6c11-py2.7.egg --prefix=/opt/python2.7.1

/opt/python2.7.1/bin/easy_install pip
ln -sf /opt/python2.7.1/bin/pip /usr/bin/pip

pip install virtualenv
ln -sf /opt/python2.7.1/bin/virtualenv /usr/bin/virtualenv

echo "alias python=/opt/python2.7.1/bin/python" >> ~/.bash_profile
echo "alias python2.7=/opt/python2.7.1/bin/python" >> ~/.bash_profile
echo "PATH=$PATH:/opt/python2.7/bin" >> ~/.bash_profile
source ~/.bash_profile

# Done

I reference this script from and it works for me. Just change the version number accordingly. At this time of post, python has 2.7.2

It will install python at /opt/python2.7.2

/opt/python2.7.2/bin/python2.7 will trigger the interpreter

No comments:

Post a Comment

Facebook - Control privacy setting of liked page

By default, Facebook displayed your liked page to public. It is the user responsibility to adjust the privacy setting. And in my opinion, F...