Python via mise — .python-version auto-detection, idiomatic_version_file_enable_tools, how mise compiles Python under the hood (python-build), the pre-built binaries route via MISE_PYTHON_COMPILE=0, and when to pin patch versions. Use when setting up Python for a project or troubleshooting Python installs.
Python is the language where mise most often earns its keep — pyenv's compilation story is slow and fragile, and system Python is usually too old or too new. mise gives you per-project pinned Python without the pyenv tax.
mise.toml [tools] python — explicit wins.mise.local.toml override..tool-versions.[settings]
idiomatic_version_file_enable_tools = ["python"]
Reads .python-version and .python-versions (plural, pyenv's multi-version file).The opt-in matters because a lot of Python projects leave stale .python-version files lying around, and silent promotion of those to authoritative would break migration from pyenv.
mise.toml[tools]
python = "3.12" # major.minor — mise picks the latest patch
python = "3.12.7" # exact
python = "3.12 3.11" # multiple versions, first is default
python = "latest" # avoid
For libraries: pin major.minor ("3.12"). Patch versions change often; don't churn your lockfile.
For services in prod parity: pin exact ("3.12.7"). Match whatever prod runs.
By default, mise compiles Python from source using python-build (the same backend pyenv uses). This is slow (5-15 minutes depending on machine) but gives you:
Pre-built route (faster, fewer options):
export MISE_PYTHON_COMPILE=0 # use pre-compiled binaries when available
mise install [email protected]
Pre-built binaries come from astral-sh/python-build-standalone and only cover recent versions. Set this in your shell rc or project mise.toml:
[env]
MISE_PYTHON_COMPILE = "0"
Rule of thumb: use pre-built for dev speed. Use compiled for production-critical services where you need exact libc match.
If you're compiling Python, the host needs build tools:
Debian/Ubuntu:
sudo apt-get install -y build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev curl libncursesw5-dev xz-utils tk-dev \
libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
macOS (via Homebrew):
brew install openssl readline sqlite3 xz zlib tcl-tk libb2
Missing libs → Python compiles but modules silently don't work (import ssl fails, sqlite3 unavailable). The mise doctor command checks for these.
mise pins the Python interpreter. It does not replace virtualenv / venv / uv / poetry — those manage the project's package set on top of a pinned interpreter.
The typical layout:
mise.toml → python = "3.12"
pyproject.toml → project deps (managed by uv/poetry/pip)
.venv/ → venv created by uv/poetry/python -m venv
mise can auto-activate a venv via:
[env]
_.python.venv = { path = ".venv", create = true }
This creates .venv using the mise-managed Python if it doesn't exist, and activates it whenever you cd into the project. Combined with uv/poetry, it's the cleanest Python setup available.
[tools]
python = "3.12"
[env]
MISE_PYTHON_COMPILE = "0"
_.python.venv = { path = ".venv", create = true }
[tasks.install]
run = "pip install -e '.[dev]'"
sources = ["pyproject.toml"]
[tools]
python = "3.12"
"pipx:uv" = "latest" # or cargo:uv if you prefer
[env]
MISE_PYTHON_COMPILE = "0"
[tasks.install]
run = "uv sync"
sources = ["pyproject.toml", "uv.lock"]
[tasks.test]
depends = ["install"]
run = "uv run pytest"
[tools]
python = "3.12"
"pipx:jupyterlab" = "latest"
"pipx:ruff" = "latest"
[env]
MISE_PYTHON_COMPILE = "0"
_.python.venv = { path = ".venv", create = true }
[tasks.lab]
run = "jupyter lab"
.python-version from pyenv with system as the content — mise doesn't know what "system" means and errors. Delete the file or replace with a real version.pyenv-virtualenv activation markers in .python-version (e.g. myvenv-3.12.7) — mise doesn't parse virtualenv names; use _.python.venv instead.which python.mise-lang-python-packages — uv vs poetry vs pipx vs pip decision.mise-migrate-from-pyenv — moving off pyenv.mise-env-directives — _.python.venv and other auto-activate directives.mise.jdx.dev/lang/python.html.github.com/astral-sh/python-build-standalone.