Manage python version with pyenv
- June 15, 2023
Install pyenv
on MacOS
brew update
brew install pyenv
- Update shell
.bashrc
or.zshrc
with following
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
How it work
Build from source on installation
Basic commands
pyenv install <version>
install a python version- Switch version
pyenv shell <version>
select python version for current shellpyenv local <version>
automatically select whenever you are in the current directory (or its subdirectories)pyenv global <version>
select globally for your user account- set
system
as<version>
-> use system provided python version
pyenv uninstall <version>
uninstall a python versionpyenv update
update pyenv