python-discovery is a Python library designed for robust discovery of Python interpreters installed on a machine. It can locate Python versions from various sources like system packages, pyenv, mise, asdf, uv, and the Windows registry (PEP 514). It verifies candidates and returns detailed metadata, with results cached for faster repeated lookups. The library is actively maintained, with frequent minor releases addressing bug fixes and feature enhancements. The current version is 1.2.1.
pip install python-discoveryVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `get_interpreter` to find Python installations based on version specifiers, leveraging `DiskCache` for performance. It attempts to find any Python 3 interpreter and then a specific range of Python 3 versions.
Review the `python-discovery` 1.0.0 release notes and adapt your code to the new API if upgrading from pre-1.0.0 versions.
Upgrade to version 1.2.0 or newer. If issues persist, check library documentation for how to configure longer timeouts if available in your version.
Upgrade to version 1.1.2 or newer to ensure correct matching of prerelease Python versions.
Upgrade to version 1.1.2 or newer to resolve potential subprocess resource handling issues.
pip install python-discovery
from python_discovery import discover_python_versions
from python_discovery import discover_python_versions
Call `discover_python_versions()` to get a list of `PythonVersion` objects instead of trying to create one manually.
No dependency data recorded yet.