- Using system python for OSX is painful. Here is an article which tells you the reason.
Using Virtual Environments to set up python for OSX
- Download latest version of get-pip.py
- Run the following:
python get-pip.py
pip install virtualenv --user
virtualenvwrapper provides a set of commands which makes working with virtual environments much more pleasant. It also places all your virtual environments in one place.
(full installation instructions)
pip install virtualenvwrapper --user
Add three lines to your shell startup file (.bash_profile, .zshrc)
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source <path-to-your-virtualenvwrapper.sh>
Note: If you cannot find your virtualenvwrapper.sh, use the following command to find it.
find / -name virtualenvwrapper.sh
mkvirtualenv py27
workon py27
If the virtualenv is activated, your shell should look at this.
Once virtualenv is set up, you can simply use pip install <package-name>
to install packages.