Manage python version with pyenv
- June 15, 2023
Install pyenv on MacOS
brew update
brew install pyenv
- Update shell
.bashrcor.zshrcwith 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
systemas<version>-> use system provided python version
pyenv uninstall <version>uninstall a python versionpyenv updateupdate pyenv