Skip to content

Instantly share code, notes, and snippets.

@huogerac
Created March 18, 2018 14:08
Show Gist options
  • Save huogerac/9153cf15a141dfce649d8a3151e7906c to your computer and use it in GitHub Desktop.
Save huogerac/9153cf15a141dfce649d8a3151e7906c to your computer and use it in GitHub Desktop.
#!/bin/bash
# This script is based on
# https://medium.com/welcome-to-the-django/guia-definitivo-para-organizar-meu-ambiente-python-a16e2479b753
PYTHON2_VERSION='2.7.12'
PYTHON3_VERSION='3.5.2'
sudo apt-get install -y git python-pip make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev
sudo pip install virtualenvwrapper
git clone https://github.com/yyuu/pyenv.git ~/.pyenv
git clone https://github.com/yyuu/pyenv-virtualenvwrapper.git ~/.pyenv/plugins/pyenv-virtualenvwrapper
mkdir -p ~/.ve
mkdir -p ~/workspacepy
echo 'export WORKON_HOME=~/.ve' >> ~/.bashrc
echo 'export PROJECT_HOME=~/workspace' >> ~/.bashrc
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
# echo 'pyenv virtualenvwrapper' >> ~/.bashrc
exec $SHELL
pyenv install $PYTHON2_VERSION
pyenv install $PYTHON3_VERSION
pyenv virtualenv $PYTHON3_VERSION jupyter3
pyenv virtualenv $PYTHON3_VERSION tools3
pyenv virtualenv $PYTHON2_VERSION ipython2
pyenv virtualenv $PYTHON2_VERSION tools2
pyenv activate jupyter3
pip install jupyter
# python -m ipykernel install --user
pyenv deactivate
# pyenv activate tools3
# pip install youtube-dl gnucash-to-beancount rows
# pyenv deactivate
pyenv activate ipython2
pip install ipykernel
# python -m ipykernel install --user
pyenv deactivate
pyenv activate tools2
pip install fabric
pyenv deactivate
# set the path order
pyenv global $PYTHON3_VERSION $PYTHON2_VERSION jupyter3 ipython2 tools3 tools2
# checking
pyenv which python
pyenv which python2
pyenv which jupyter
pyenv which ipython
pyenv which ipython2
pyenv which fabric
# usage samples:
# mkproject newproject_py3
# workon newproject_py3
# mkvirtualenv -a ~/workspace/existing_py2 -p python2 existing_py2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment