Pyenv Cheatsheet

Pyenv Cheatsheet #

Install #

List available python versions:

$ pyenv install -l

Install a specific version of Python:

$ pyenv install 3.10.0

Versions #

The versions command displays all currently installed Python versions:

$ pyenv versions

Global #

Set the global Python version

pyenv global 3.10.0

Local #

Set an application-specific Python version. This command creates a .python-version file in your current directory. If you have pyenv active in your environment, this file will automatically activate this version for you.

pyenv local 3.10.0

Shell #

set a shell-specific Python version. This command activates the version specified by setting the PYENV_VERSION environment variable. This command overwrites any applications or global settings you may have. Use the –unset flag to deactivate the version.

pyenv shell 3.10.0

Which #

The which command is helpful for determining the full path to a system executable.

pyenv which pip
pyenv which python