Skip to content

Instantly share code, notes, and snippets.

@masnick
Last active May 23, 2016 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masnick/c22b6c8eb59f9d8110f7edf5bc6215e9 to your computer and use it in GitHub Desktop.
Save masnick/c22b6c8eb59f9d8110f7edf5bc6215e9 to your computer and use it in GitHub Desktop.
pyenv setup instructions

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment