I have installed pyenv in MacOS Sonoma 14.1.1 version. I have added the following to ~/.zshrc and ~/.bashrc files according to this answer:
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
export PIPENV_PYTHON="$PYENV_ROOT/shims/python"
plugin=(
pyenv
)
eval "$(pyenv init -)"
eval "$(command pyenv init --path)"
eval "$(pyenv virtualenv-init -)"
The problem is that when opening a new terminal after activating a pyenv through pyenv activate 3.10.7 and asking python --version, I got: zsh: command not found: python. But, if I use these commands:
eval "$(command pyenv init -)"
eval "$(command pyenv init --path)"
When asking again python --version, Python 3.10.7 is shown in the terminal.
I wonder why this is not working correctly after I added the $PATH command in ~/.zshrc and ~/.bashrc files.