lee-pai-long
3/15/2016 - 2:03 PM

Enable deadsnakes PPA, install Python 2.6, 2.7, 3.2 and 3.3, install easy_install and pip in to those versions

Enable deadsnakes PPA, install Python 2.6, 2.7, 3.2 and 3.3, install easy_install and pip in to those versions

#!/usr/bin/env bash
 
sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O /tmp/ez_setup.py
py_ver=`python -c 'import sys; print ".".join(str(x) for x in sys.version_info[:2])'`

for i in 2.6 2.7 3.2 3.3
do
  if [ "$i" != "$py_ver" ]
  then
    sudo apt-get -y install python$i python$i-dev
    sudo python$i /tmp/ez_setup.py
    sudo easy_install-$i pip
  else
    echo "Default Python version is $i, installing dev libraries and pip only"
    sudo apt-get install -y python$-dev
    sudo python$i /tmp/ez_setup.py
    sudo easy_install-$i pip
  fi
done