Skip to content

Base tools

pyenv

pyenv is a version manager for Python. It allows to install multiple versions of Python on the same machine.
Combined with pyenv-virtualenv plugin, it is also able to manage virtualenvs.

Install a python version

pyenv install 3.11.2

Activate a Python version

pyenv shell 3.11.2

Create a virtualenv

pyenv virtualenv 3.11.2 dev

Activate a virtualenv

pyenv shell dev

Auto-activate a virtualenv

You can configure auto-activation of dev virtualenv when entering the current directory by using the following command:

pyenv local dev

This will create a .python-version file in your directory with the name of the specified virtualenv. pyenv-virtualenv shell extension will automatically enable the virtualenv when entering the directory.

Tip

Installed Python versions and virtualenvs are located in ${PYENV_ROOT}/versions

pipx

pipx is an application manager for Python. It creates a dedicated virtualenv for each application and adds it to your PATH.

Install a Python application

pipx install cookiecutter

Tip

Each application is installed in a dedicated virtualenv located in ${HOME}/.local/pipx/venvs