Hi, I hope this isn't a duplicate. I'm setting up pyenv for the first time and pyenv init - is creating a path for zsh-completion, that isn't source-able. I could reproduce this issue on #877 and latest master version. ae11c56565ac7640cf909d9aa04955982561b88e. zsh --version 5.3.1 (x86_64-debian-linux-gnu) on Debian Stretch with oh-my-zsh configured.
$ export PYENV_ROOT="$HOME/.pyenv"
$ export PATH="$PYENV_ROOT/bin:$PATH"
$ $(pyenv init -)
/home/<$USER>/.zshrc:export:165: not valid in this context: '/home/<$USER>/.pyenv/libexec/../completions/pyenv.zsh'
Output of $ pyenv init -:
export PATH="/home/<$USER>/.pyenv/shims:${PATH}"
export PYENV_SHELL=zsh
source '/home/<$USER>/.pyenv/libexec/../completions/pyenv.zsh'
command pyenv rehash 2>/dev/null
pyenv() {
local command
command="$1"
if [ "$#" -gt 0 ]; then
shift
fi
case "$command" in
rehash|shell)
eval "$(pyenv "sh-$command" "$@")";;
*)
command pyenv "$command" "$@";;
esac
}
Quick 'fix':
Copying the output of pyenv init - into my .zshrc and replace the line source [...]/pyenv.zsh with source '/home/<$USER>/.pyenv/completions/pyenv.zsh'.
I have no time to look into the source instantly, so I'm creating the issue. I guess we can resolve this by using something like realpath: source "$(realpath -e pyenv.zsh)".
Thank you!
I should have used eval "$(pyenv init -)"
Most helpful comment
I should have used
eval "$(pyenv init -)"