I would like to use pyenv to switch python2 and python3.
I successfully downloaded python2 and python3 and pyenv with following codes.
brew install pyenv
brew install pyenv-virtualenv
pyenv install 2.7.10
pyenv install 3.5.0
However, I cannot switch from python2 to python3..
Soma-Suzuki:~ Soma$ python --version
Python 2.7.10
Soma-Suzuki:~ Soma$ pyenv global
2.7.10
Soma-Suzuki:~ Soma$ pyenv versions
system
* 2.7.10 (set by /Users/Soma/.pyenv/version)
3.5.0
Soma-Suzuki:~ Soma$ pyenv global 3.5.0
Soma-Suzuki:~ Soma$ pyenv global
3.5.0
Soma-Suzuki:~ Soma$ pyenv versions
system
2.7.10
* 3.5.0 (set by /Users/Soma/.pyenv/version)
Soma-Suzuki:~ Soma$ python --version
Python 2.7.10
Soma-Suzuki:~ Soma$
I do not understand why this happens.
For your information. My python is in this directory.
Soma-Suzuki:~ Soma$ which python
/usr/bin/python
Thank you in advance.
Try this: eval "$(pyenv init -)"
Example:
$ python -V
Python 2.7.9
mac:~ $ eval "$(pyenv init -)"
mac:~ $ python -V
Python 3.5.0
More info: https://github.com/pyenv/pyenv