- Use the pyenv-installer
- Update
.bashrc
:
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
- Update
pyenv
:
pyenv update
- List available versions:
pyenv install ---list
- Install a specific version:
pyenv install 3.9.7
- Use a specific version globally:
pyenv global 3.9.7