Pyenv is a Python version manager that makes it easy to install and switch between multiple Python versions on the same machine.
Features
- 📦 Manage multiple Python versions
- 🔄 Switch versions quickly
- 🎯 Pin a specific version for each project
- 🌐 Support virtual environments
- 🪟 Cross-platform support for Windows, Linux, and macOS
Installation
Windows
Use pyenv-win:
Add environment variables:
Linux/macOS
Configure your shell by adding the following to ~/.bashrc or ~/.zshrc:
Basic usage
Show installable versions
Install Python versions
Show installed versions
Switch Python versions
Uninstall a version
Advanced usage
Set a version for a project
Virtual environments
Use it together with pyenv-virtualenv:
Show where the current version comes from
Refresh shims
Configuration files
Global configuration
Project configuration
Shell configuration
FAQ
Installation failed
Missing Linux dependencies:
Version switching does not take effect
Windows path issues
Make sure the environment variables are configured correctly, then restart the terminal.
Best practices
- Set a local version for every project to avoid global version conflicts.
- Use virtual environments together with
pyenv-virtualenv.
- Commit
.python-version when the team should use the same version.
- Update pyenv regularly to get support for new versions.
- Record dependencies with
requirements.txt or Pipfile.
Quick reference
References
Last modified on April 17, 2026