Skip to content

pyenv

A command-line tool for installing and switching between multiple Python versions.

Stars
45.2k
Forks
3.3k
Licence
MIT
Language
Shell
Last update
5 days ago
Type
Dev tool

What it is

pyenv is a command-line tool that lets you install several versions of Python on one computer and switch between them. You can set a global default for your user account, set a different version per project, or override it with an environment variable. It is built from shell scripts and works by placing a directory of small wrapper programs called shims on your PATH.

  • Install a specific Python version with pyenv install
  • Set a global default Python version for your user account
  • Pin a particular Python version for a single project directory
  • Run commands against several Python versions in turn, for example to test a library across versions

Great for

  • Developers who work on several Python projects that need different Python versions
  • People testing code across multiple Python versions, for example with tox
  • Linux and macOS users who want a per-user Python setup without touching system Python

Not ideal for

  • Windows users, since the README says pyenv does not officially support Windows outside WSL; the maintainers point to pyenv-win instead
  • People who want pyenv to also manage virtual environments, since the README says it does not do that; pyenv-virtualenv is a separate project
  • Users who need native Windows Python builds, because the Pythons pyenv installs under WSL are Linux builds
Step-by-step guide: how to use pyenvInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Download the app

    You'll need: A Unix-like system such as Linux or macOS, or WSL on Windows · git, if you use the GitHub checkout method

    Automatic installer (recommended, Linux/Unix)

    curl -fsSL https://pyenv.run | bash

    Install via Homebrew (macOS)

    brew install pyenv

    Basic GitHub checkout

    git clone https://github.com/pyenv/pyenv.git ~/.pyenv
  2. 2

    Run it

    • Install pyenv using the installer, Homebrew, or a git checkout
    • Add the shell setup code by running pyenv init --install, or follow the manual Bash or Zsh instructions in the README
    • Restart your shell with exec "$SHELL"
    • Install a Python version with pyenv install, then switch to it with pyenv global or pyenv local
  3. 3

    Get the most out of it

    • Use pyenv local to set a version per project directory so each project picks its own Python
    • Use the environment variable override to change the version for a single command or session
    • Install the build dependencies listed in the README wiki before installing new Python versions
    • Use pyenv-virtualenv, which the README links to, if you want virtual environment management

Downloads

Strengths

  • Simple, single-purpose design that follows the UNIX tradition, according to the README
  • Written in pure shell scripts, so it does not depend on an existing Python install
  • Supports several Python distributions, including CPython, PyPy, and Stackless Python

Trade-offs

  • Installing a Python version can require build dependencies, which the README covers in a separate wiki page
  • Shell setup is needed so the shims and PATH changes take effect, and the README gives different steps for Bash and other shells
  • No native Windows support; Windows users must use WSL or a fork

How it compares

ProjectStarsTypeLevelUpdatedBest for
pyenv (this)45.2kDev toolintermediate5 days agoDevelopers who work on several Python projects that need different Python versions
asdf25.6kDev toolbeginner5 days agoDevelopers who work on several projects that need different language versions
ohmyzsh190kDev toolbeginner4 days agoPeople who already use zsh and want a ready-made configuration without writing it from scratch
nvm95.7kDev toolbeginner8 days agoDevelopers who work on several Node.js projects that need different versions
nushell40.8kDev toolintermediate5 days agoDevelopers who work a lot in the terminal and want to query files, processes, or config files as data
zoxide40.4kDev toolbeginner4 days agoDevelopers who move between many project folders in a terminal

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.