Manage Python Versions With pyenv
Install multiple Pythons and select one per directory or globally.
Run pyenv install 3.12.0 to build a Python version, then pyenv global 3.12.0.
01Command
Command
$ pyenv install 3.12.002What it does
pyenv keeps each Python version under ~/.pyenv and switches using shims, driven by .python-version, PYENV_VERSION or the global file. It leaves the system Python untouched, which avoids breaking OS tools.
03Risk
!Warning: Each version is compiled from source, so building Python can take several minutes and requires build dependencies.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- Homebrew formula: pyenvEvidence: Python version management. Packages pyenv, a tool that manages multiple Python versions cleanly.
Last verified: 2026-09-22 · Category: Developer