My .zshenv contains
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
which works fine, however, if I simply add
eval "$(pyenv virtualenv-init -)"
I keep receiving the message
zsh: command not found: pyenv
Pyenv and pyenv-virtualenv work perfectly fine and if I enter exec "$SHELL" the message goes away until I restart the terminal so I'm sure what the issue is.
I'm running Arch Linux, Zsh 5.4.2-1, tmux 2.5-3, termite 12-2, and the master branch of both pyenv and pyenv-virtualenv pulled today.
It eval "$(pyenv virtualenv-init -)" is showing errors like "zsh: command not found: pyenv", it indicates that pyenv-virtualenv-init was called before pyenv-init. Since pyenv-virtualenv is heavily depending on pyenv, it needs to be initialized after pyenv has initialized.
Pasting your full zsh configurations (regard to pyenv/pyenv-virtualenv) here could help further investigation.
I have same issue
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
eval "$(pyenv virtualenv-init -)"
entire contents of my .zshenv and copy pasting it to a loaded shell works as intented.
just ditching my .zshenv file and pasting its contents into .zshrc works as intended as well.
I'm using ohmyzsh if that makes any diff.
I have the same issue.
My ~/.zshenv file:
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 -)"
My guess is that pyenv is being installed in a location that zsh doesn't use by default (like /usr/local/bin). You probably have a line at the top of your .zshrc that looks like export PATH=$HOME/bin:/usr/local/bin:$PATH. Moving that line to the top of your .zshenv might fix the problem for you.
My guess is that pyenv is being installed in a location that zsh doesn't use by default (like /usr/local/bin). You probably have a line at the top of your .zshrc that looks like
export PATH=$HOME/bin:/usr/local/bin:$PATH. Moving that line to the top of your .zshenv might fix the problem for you.
Works for me, thanks :smile:
Some update ?
I had this issue, after following https://github.com/pyenv/pyenv-installer
I changed my ~/.zshrc from:
export PATH="~/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
To
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
export PATH="$HOME/.pyenv/bin:$PATH" eval "$(pyenv init -)" eval "$(pyenv virtualenv-init -)"
nice
Opened a PR to change this https://github.com/pyenv/pyenv-installer/pull/86
I had this issue, after following https://github.com/pyenv/pyenv-installer
I changed my
~/.zshrcfrom:export PATH="~/.pyenv/bin:$PATH" eval "$(pyenv init -)" eval "$(pyenv virtualenv-init -)"To
export PATH="$HOME/.pyenv/bin:$PATH" eval "$(pyenv init -)" eval "$(pyenv virtualenv-init -)"
Cool, tk you verry much
The above fix didn't work for me though. I used the following block in ~/.zshrc instead:
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
fi
Most helpful comment
I had this issue, after following https://github.com/pyenv/pyenv-installer
I changed my
~/.zshrcfrom:To