To install, just type:
$ brew install pyenv
Add this to your .bash_profile
:
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
Once installed use pyenv
to install python versions you need:
$ pyenv install -l/--list --> List all available versions
$ pyenv install 2.7.6
$ pyenv install 3.3.3
Run this command after you install a python version:
$ pyenv rehash
You can specify multiple versions via PYENV_VERSION
at once. Let's say if you have two versions of 2.7.6 and 3.3.3. If you prefer 2.7.6 over 3.3.3,
$ pyenv shell 2.7.6 3.3.3
$ pyenv versions
system
* 2.7.6 (set by PYENV_VERSION environment variable)
* 3.3.3 (set by PYENV_VERSION environment variable)
$ python --version
Python 2.7.6
$ python2.7 --version
Python 2.7.6
$ python3.3 --version
Python 3.3.3