macOSLinux

Where Does pyenv Install Python Versions?

Where pyenv installs Python versions under PYENV_ROOT on macOS and Linux, and the commands that list them.

Last updated

pyenv installs each Python under $(pyenv root)/versions, defaulting to ~/.pyenv/versions. Shims in ~/.pyenv/shims intercept python calls and route to the version your directory selects, so system Python stays untouched.

Selection stacks three deep: PYENV_VERSION env var beats a local .python-version file, which beats the global setting. Run pyenv version (singular) to see which level is deciding right now. That one command settles most it works on their machine arguments.

Where pyenv stores this, by platform

macOS
~/.pyenv/versions

Homebrew installs still use ~/.pyenv by default. Override the base with PYENV_ROOT. Plugins (pyenv-virtualenv, pyenv-update) live in the plugins sibling.

Linux
~/.pyenv/versions

Same layout as macOS. WSL setups use this Linux path rather than any Windows Python. Each version folder is self contained and deletable.

Frequently asked questions

Which Python is actually running right now?

Run pyenv versions for installed versions with the active one starred, and pyenv root for the base directory. The shims folder on PATH routes python to whichever version .python-version files (or pyenv global) select.

How do I remove a Python version cleanly?

Delete the version folder under versions/ (or run pyenv uninstall <version>). Virtualenvs from pyenv-virtualenv live beside them and must go too if they were built on that version. Reinstalls are one pyenv install away.

Notice an outdated path? Let us know.