#Homebrew Mac First you need Homebrew installed.
Requirements:
- OS X 10.5 or higher 2
- Command Line Tools for Xcode:
xcode-select --install, https://developer.apple.com/downloads
- A Bourne-compatible shell for installation (e.g. bash or zsh) 4
Install Homebrew:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
###Edit bashrc In order to use homebrew to install packages brew needs to be added to the users path.
sudo nano ~./bashrc
Add the following to the bashrc file:
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
###Install Python
brew install python
Check that the installed version of python is being used and not the default version that comes with OSX:
which python
Should return
/usr/local/bin/python
##Virtualenv Install pip install virtualenv
To set up a new Python environment, move into the directory where you would like to store the environment, and use the virtualenv utility to create the new environment.
virtualenv venv
To use an environment, run
source venv/bin/activate
Your command prompt will change to show the active environment. Once you have finished working in the current virtual environment, run deactivate to restore your settings to normal.