← Back

Pyenv

Pythonpyenv
Published:


Pyenv

pyenv is a tool that lets you easily switch between multiple versions of Python. (That is not installed on your system). Includes the tox library that allows you to run your tests in multiple Python versions.

You can install the pyenv-virtualenv plugin to manage virtual environments with pyenv. Pyenv-virtualenv Github.

To create pyenv virtualenv 3.10-dev <your_pyenv>. To activate pyenv activate <your_pyenv>. By default, .venv folder is created in your HOME directory.

Installing pyenv

# Linux
curl https://pyenv.run | bash

# macOS
brew install pyenv

# Windows
# Check https://github.com/pyenv-win/pyenv-win

Using pyenv

# List supported Python versions
pyenv install --list

# Install a Python version
# The --debug flag will use a debug build of Python which is useful for debugging CPython itself. Such as using gdb.
pyenv install <version>