brew update
brew install pyenv
Add the following line to ~/.bash_profile
:
eval "$(pyenv init -)"
brew install pyenv-virtualenvwrapper
pyenv virtualenvwrapper
Add the following to ~/.bash_profile
:
export PYENV_VIRTUALENVWRAPPER_PREFER_PYVENV="true"
Restart your shell or source your profile:
source ~/.bash_profile
git clone https://github.com/yyuu/pyenv-pip-rehash.git ~/.pyenv/plugins/pyenv-pip-rehash
List available Python versions you can install:
pyenv install --list
Install a Python version
pyenv install 2.7.8
pyenv install 3.4.1
See what Python versions you have installed:
pyenv versions
Switch Python versions globally or locally:
pyenv global 2.7.8
pyenv local 2.7.8
Create a virtualenv:
mkvirtualenv my-venv
Install a package with pip:
pip install ipython
You don't want to use mkvirtualenv with pyenv. It won't show up when you do 'pyenv virtualenvs' so that will be aggravating.
Something like this is the way to go:
pyenv virtualenv 3.6.3 espstuff
This guy's cheatsheet is nice: https://github.com/malexer/cheatsheets/blob/master/pyenv.md