FindPython
A utility to find python versions on your system.
Description
This library is a rewrite of pythonfinder project by @techalchemy. It simplifies the whole code structure while preserving most of the original features.
Installation
FindPython can be used in both Python and Rust projects.
To install FindPython in Python:
To install FindPython in Rust:
Or use FindPython library in a Rust project:
Python Usage
>>>
>>> # Find by major and minor version
< =////.9, =3.9.17, =64bit>
>>> # Find by version string
< =////.9, =3.9.17, =64bit>
>>> # Find by version string and architecture
< =://3.9-32/ , =3.9.10, =32bit>
>>> # Find by executable name
< =//////.// , =3.11.4, =64bit>
>>> # Find by executable name without keyword argument, same as above
< =//////.// , =3.11.4, =64bit>
>>> # Same arguments as `find()`, but return all matches
Rust Usage
use ;
CLI Usage
In addition, FindPython provides a CLI interface to find python versions:
Find python executables on your system
Usage: findpython [OPTIONS] [VERSION_SPEC]
Arguments:
[VERSION_SPEC] The version spec to find, e.g. 3|3.8|python3
Options:
-a, --all Return all matching Python versions
--resolve-symlinks Resolve symlinks and remove duplicate results
--no-same-file Remove duplicate results that are the same binary
--no-same-python Remove duplicate results that wrap the same Python interpreter
--providers <PROVIDERS> Select provider names(comma-separated) to use
-o, --output <OUTPUT> The output format [default: default] [possible values: default, json, path]
-h, --help Print help
-V, --version Print version
Integration
FindPython finds Python from the following places:
PATH
environment variable- pyenv
- asdf
- winreg (Windows only)
- Rye project manager backed by python-build-standalone
License
FindPython is released under MIT License.