Cheat sheet: pyenv
I wrote this post as a reference for myself. Maybe you'll find it useful as well.
Project set up
pyenv install --list
pyenv install 3.12.2
pyenv virtualenv 3.12.2 my-awesome-project
cd projects
mkdir my-awesome-project
cd my-awesome-project
pyenv local my-awesome-project
Project tear down
cd projects/my-awesome-project
pyenv local --unset
pyenv uninstall my-awesome-project
cd ..
rm -r my-awesome-project
Commands
The complete pyenv
command reference list can be found here.
pyenv
pyenv commands
# List all available pyenv commands.
pyenv help
# List all available pyenv commands along with a brief description of what they do
pyenv help <command>
# Display help for a specific command.
# pyenv help install
pyenv install --list
# List all available version of Python, including Anaconda, Jython, pypy, and stackless.
pyenv install <version>
# Install the latest version in a specific version line or a specific version.
# pyenv install 3.12 | pyenv install 3.12.2
pyenv uninstall <version>
# Uninstall the specific version (or env).
# pyenv uninstall 3.12.2 | pyenv uninstall my-env
pyenv version
# Display the currently active Python version.
pyenv versions
# List all Python versions known to pyenv.
pyenv global <version>
# Set the global version.
# pyenv global 3.12.2
pyenv local <version>
# Set the version (or env) for the current directory.
# pyenv local 3.12.2 | pyenv local my-env
pyenv local --unset
# Unset the version (or env) for the current directory.
pyenv-virtualenv
pyenv virtualenv <version> <environment>
# Create a new virtual environment with a specific version of Python.
# pyenv virtualenv 3.12.2 my-env
pyenv virtualenv <environment>
# Create a virtual environment for the current pyenv Python version.
# pyenv virtualenv my-env
Discussion