OS X ships with an old version of Python 2. Here's how I set up my system:
brew install pyenv pyenv-virtualenv
Then add to .zshrc
or .bashrc
:
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
Then restart Terminal.app, and build the newest version of Python:
pyenv install -l
# Scroll through to find the newest version of 2.x.x.
# At time of writing, this was 2.7.10
pyenv install 2.7.10
# Use this version everywhere
pyenv global 2.7.10
Then set up a virtualenv for IPython. I call mine data
:
pyenv virtualenv data
To activate the virtualenv:
pyenv activate data
Install dependencies:
pip install pandas numpy matplotlib epipy
pip install "ipython[all]"
That should do it. Now you can type pyenv virtualenv data
to have Python 2.7.10 with all the scipy/IPython dependencies.
Note that this will also allow you to run Python 3 alongside Python 2, without messing up the OS X system Python.