Cannot switch Python with pyenv Cannot switch Python with pyenv python python

Cannot switch Python with pyenv


Try this: eval "$(pyenv init -)"

Example:

$ python -VPython 2.7.9mac:~ $ eval "$(pyenv init -)"mac:~ $ python -VPython 3.5.0

More info:https://github.com/pyenv/pyenv


[July 2021]
If you see this message when running eval "$(pyenv init -)"

WARNING: `pyenv init -` no longer sets PATH.Run `pyenv init` to see the necessary changes to make to your configuration.

you should check the message from pyenv init as the warning says, but in a nutshell, you can use eval "$(pyenv init --path)" instead.

And don't forget to accordingly update your ~/.bash_profile, ~/.zshrc or the like if necessary.


You forgot to add this eval "$(pyenv init -)".

Add this to your .bash_profile or .bashrc file (mac <=10.14) or to your .zshrc file (mac 10.15+)