Skip to content

Instantly share code, notes, and snippets.

@whoshuu
Last active November 19, 2015 01:05
Show Gist options
  • Save whoshuu/11159710 to your computer and use it in GitHub Desktop.
Save whoshuu/11159710 to your computer and use it in GitHub Desktop.
Bootstrap installation of pip, virtualenv, and virtualenvwrapper
#!/bin/bash
###########################################################################################
# bootstrap.sh
#
# To run directly from web:
# wget -O - https://gist.githubusercontent.com/whoshuu/11159710/raw/bootstrap.sh | bash
# Else:
# ./bootstrap.sh
#
# Tested on:
# Ubuntu 12.04 LTS
###########################################################################################
CUR_DIR="$PWD"
BASHRC=$HOME/.bashrc
cd $HOME
wget https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.11.4.tar.gz
tar xzvf virtualenv-1.11.4.tar.gz
mkdir .virtualenvs
python virtualenv-1.11.4/virtualenv.py --distribute --no-site-packages --python=.pynest/2.7.6/bin/python .virtualenvs/base
. .virtualenvs/base/bin/activate
pip install git+https://[email protected]/huu/virtualenvwrapper.git
cp pynest .virtualenvs/base/bin
echo '' >> $BASHRC
echo '' >> $BASHRC
echo '# set up virtual environment using base environment' >> $BASHRC
echo '#===================================================' >> $BASHRC
echo 'source '$HOME'/.virtualenvs/base/bin/activate' >> $BASHRC
echo 'source '$HOME'/.virtualenvs/base/bin/virtualenvwrapper.sh' >> $BASHRC
echo 'source -d '$HOME'/.virtualenvs/base/bin/pynest' >> $BASHRC
echo 'export WORKON_HOME='$HOME'/.virtualenvs' >> $BASHRC
echo 'export VIRTUALENV_DISTRIBUTE=1' >> $BASHRC
echo 'export VIRTUALENVWRAPPER_HOOK_DIR=$WORKON_HOME/hooks' >> $BASHRC
echo 'deactivate' >> $BASHRC
rm -rf virtualenv-*
cd $CUR_DIR
echo "$(tput setaf 2)Restart your shell session and use 'mkvirtualenv {env_name}' to create a new virtual environment!$(tput sgr 0)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment