Pyenv Does Not Use Correct Python Version
using pyenv 2.0.3 when i'm in a folder with a python-version file, the python keeps using the system version which is 2.7.6. (not sure why it is 2.7.6 since i install 3.9.7 via bre
Solution 1:
The answer is to put the shims on the path
# pyenvexport PYENV_ROOT="$HOME/.pyenv"export PATH="$PYENV_ROOT/shims:$PATH"ifwhich pyenv-virtualenv-init > /dev/null; theneval"$(pyenv virtualenv-init -)"; fi#if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
Solution 2:
Assuming you're running MacOS and have installed pyenv
via Homebrew, you'll need to do the following:
# Adjust the session-wide environment for your account.echo'eval "$(pyenv init --path)"' >> ~/.zprofile
# Enable autocompletion and all subcommandsecho'eval "$(pyenv init -)"' >> ~/.zshrc
From pyenv installation docs:
MacOS note: If you installed Pyenv with Homebrew, you don't need to add the PYENV_ROOT= and PATH= lines. You also don't need to add commands into ~/.profile if your shell doesn't use it.
Post a Comment for "Pyenv Does Not Use Correct Python Version"