fix(pyenv): preserve shims in login shells

macOS path_helper runs after .zshenv and can move system Python ahead of pyenv. Add an idempotent login hook and preserve it across later easyzsh migrations.
This commit is contained in:
Frank Qing
2026-08-07 18:34:50 +08:00
parent 9257eceb47
commit e41d2b6e93
5 changed files with 54 additions and 7 deletions
+3 -2
View File
@@ -1,7 +1,8 @@
# pyenv (Python Version Manager), always-on via ~/.zshenv
export PYENV_ROOT="${PYENV_ROOT:-$HOME/.pyenv}"
[[ -d "$PYENV_ROOT/bin" ]] && export PATH="$PYENV_ROOT/bin:$PATH"
[[ -d "$PYENV_ROOT/shims" ]] && export PATH="$PYENV_ROOT/shims:$PATH"
[[ -d "$PYENV_ROOT/bin" ]] && path=("$PYENV_ROOT/bin" ${path:#$PYENV_ROOT/bin})
[[ -d "$PYENV_ROOT/shims" ]] && path=("$PYENV_ROOT/shims" ${path:#$PYENV_ROOT/shims})
export PATH
if [[ -o interactive ]] && command -v pyenv &> /dev/null; then
eval "$(pyenv init - zsh)"
fi