Failed to activate virtualenv with pyenv

Within ~/.zshrc file:

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"

eval "$(pyenv init --path)"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

Sadly the eval lines alone (as mentioned in the pyenv and pyenv-virtualenv instructions) did not work for me.


That

eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

should be in .bashrc, not .bash_profile. The latter is executed only by login shells, the former by all interactive shells.