#!/bin/bash -eux

SSH_USER=${SSH_USERNAME:-vagrant}

export HOME=/home/${SSH_USER}

echo "==> Installing Python 2.7"
sudo add-apt-repository -y ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install -y python python-dev

echo "==> Installing setuptools"
sudo wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
sudo python ez_setup.py
rm ez_setup.py setuptools-*

echo "==> Installing pip"
sudo easy_install pip

echo "==> Installing virtualenvwrapper"
sudo pip install virtualenvwrapper

echo "==> Configuring virtualenvwrapper"
mkdir -p ${HOME}/.virtualenvs
echo "WORKON_HOME=${HOME}/.virtualenvs" >> ${HOME}/.bashrc
echo "source /usr/local/bin/virtualenvwrapper.sh" >> ${HOME}/.bashrc

chown -R ${SSH_USER}:${SSH_USER} ${HOME}/.virtualenvs
export HOME=/home/root

#!/bin/bash -eux

SSH_USER=${SSH_USERNAME:-vagrant}

export HOME=/home/${SSH_USER}

echo "==> Installing Pyenv build tools"
# From https://github.com/yyuu/pyenv/wiki/Common-build-problems
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm

echo "==> Preparing Pyenv configuration."
echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> /home/${SSH_USER}/.bashrc
echo 'eval "$(pyenv init -)"' >> /home/${SSH_USER}/.bashrc
echo 'eval "$(pyenv virtualenv-init -)"' /home/${SSH_USER}/.bashrc

su ${SSH_USER} <<EOF
echo "==> Installing Pyenv"
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
source ~/.bashrc
env PATH=/home/vagrant/.pyenv/bin:$PATH pyenv install 2.7.9
env PATH=/home/vagrant/.pyenv/bin:$PATH pyenv install 3.4.3
env PATH=/home/vagrant/.pyenv/bin:$PATH pyenv global 2.7.9
EOF

chown -R ${SSH_USER}:${SSH_USER} /home/${SSH_USER}

Replace this with Pyenv for multiple Python installation
Replace this with Pyenv for multiple Python installation

Installs Python 2 and 3 and set 2 to be global.
