poetry env use: Select the Python Interpreter
Pin the Python version Poetry builds its environment with.
poetry env use tells Poetry which Python interpreter to create or use for the project environment. A CI matrix uses it to target each Python version explicitly.
What it does
Creates (or switches to) a project virtual environment backed by the named interpreter. Accepts a version like 3.11, a full path, or "system".
Common usage
Terminal
poetry env use 3.11
poetry env use /usr/bin/python3.12
poetry env use python3.11
poetry env infoCommon CI error: interpreter not found
If the requested Python is not installed on the runner, poetry env use fails. Install or set up that Python (e.g. via setup-python) before selecting it.
Terminal
# Failure:
# Could not find the python executable python3.11
# Fix: ensure the interpreter exists first, then:
poetry env use 3.11Related guides
poetry run: Run a Command in the Project EnvHow poetry run executes a command inside the project’s virtual environment without activating it, common CI u…
poetry install: Install from the LockfileHow poetry install resolves and installs dependencies from poetry.lock, the --no-root and --only flags useful…
python -m venv: Create Virtual EnvironmentsHow python -m venv creates an isolated virtual environment, how to activate it on Linux and Windows runners,…