Search code examples
pyenv

How to resolve .zshenv. command not found pyenv?


I have pyenv installed and my .zshenv looks like the following :

export PYENV_ROOT="$HOME"/.pyenv
export PATH="$PYENV_ROOT"/bin:"$PATH"
if command -v pyenv 1>/dev/null 2>&1; then
  eval "$(pyenv init -)"
fi
eval "$(pyenv virtualenv-init -)"

When I open a new terminal it gives me the following error:

.zshenv. command not found: : pyenv


Solution

  • The fix in the github issue link didn't work for me.

    The problem was that pyenv wasn't on the path at the time of running pyenv init.

    I add export PATH=/usr/local/bin:"$PATH" to my .zshenv before calling pyenv init.