Python interpreter discovery
Project Links
Meta
Maintainer: Bernát Gábor
Requires Python: >=3.8
Classifiers
Development Status
- 5 - Production/Stable
Intended Audience
- Developers
License
- OSI Approved :: MIT License
Operating System
- MacOS :: MacOS X
- Microsoft :: Windows
- POSIX
Programming Language
- Python :: 3 :: Only
- Python :: 3.8
- Python :: 3.9
- Python :: 3.10
- Python :: 3.11
- Python :: 3.12
- Python :: 3.13
- Python :: 3.14
- Python :: Implementation :: CPython
Topic
- Software Development :: Libraries
- Utilities
python-discovery
What is python-discovery?
python-discovery is a library for discovering Python interpreters installed on your machine. You may have multiple
Python versions from system packages, pyenv, mise,
asdf, uv, or the Windows registry (PEP 514). This library finds
the right one for you.
Give it a requirement like python3.12 or >=3.11,<3.13, and it searches all known locations, verifies each candidate,
and returns detailed metadata about the match. Results are cached to disk so repeated lookups are fast.
Usage
from pathlib import Path
from python_discovery import DiskCache, get_interpreter
cache = DiskCache(root=Path("~/.cache/python-discovery").expanduser())
result = get_interpreter("python3.12", cache=cache)
if result is not None:
print(result.executable) # /usr/bin/python3.12
print(result.implementation) # CPython
print(result.version_info[:3]) # (3, 12, 1)
The get_interpreter() function accepts various specification formats:
- Absolute path:
/usr/bin/python3.12 - Version:
3.12 - Implementation prefix:
cpython3.12 - PEP 440 specifier:
>=3.10,>=3.11,<3.13
Documentation
Full documentation is available at python-discovery.readthedocs.io
1.2.1
Mar 26, 2026
1.2.0
Mar 19, 2026
1.1.3
Mar 10, 2026
1.1.2
Mar 09, 2026
1.1.1
Mar 07, 2026
1.1.0
Feb 26, 2026
1.0.0
Feb 25, 2026