Setup a python2 dev environment on a Mac

August 19, 2016

  1. Install homebrew
  2. brew install python to not use the (possibly outdated) system python (this also installs pip and setuptools)
  3. pip install virtualenv
  4. pip install virtualenvwrapper
  5. Add the following to ~/.bash_profile:
    export WORKON_HOME=$HOME/.virtualenvs
    export PROJECT_HOME=/Users/dhruvkar/<projectdirectory>
    source /usr/local/bin/virtualenvwrapper.sh
  6. To make virutal environments for existing projects use: mkvirtualenv -a [project directory path] [ENVIRONMENT NAME]
  7. Assuming a requirements.txt file in existing project: pip install -r requirements.txt