Manage Python Versions With pyenv

Install multiple Pythons and select one per directory or globally.

macOSpackagespythonversionLow risk
Run pyenv install 3.12.0 to build a Python version, then pyenv global 3.12.0.

01Command

Command
$ pyenv install 3.12.0

02What 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

RiskLow risk
CompatibilitymacOS with Homebrew installed
!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: pyenv
    Homebrew · vendor-doc · 2026-09-20
    Evidence: Python version management. Packages pyenv, a tool that manages multiple Python versions cleanly.

Last verified: 2026-09-22 · Category: Developer

06Related solutions