pythonfinder.pythonfinder module¶
-
class
pythonfinder.pythonfinder.
Finder
(path=None, system=False, global_search=True, ignore_unsupported=True, sort_by_path=False)[source]¶ Bases:
object
A cross-platform Finder for locating python and other executables.
Searches for python and other specified binaries starting in path, if supplied, but searching the bin path of
sys.executable
if system isTrue
, and then searching in theos.environ['PATH']
if global_search isTrue
. When global_search isFalse
, this search operation is restricted to the allowed locations of path and system.-
find_all_python_versions
(major=None, minor=None, patch=None, pre=None, dev=None, arch=None, name=None)[source]¶
-
find_python_version
(major=None, minor=None, patch=None, pre=None, dev=None, arch=None, name=None, sort_by_path=False)[source]¶ Find the python version which corresponds most closely to the version requested.
- Parameters
int] major (Union[str,) – The major version to look for, or the full version, or the name of the target version.
minor (Optional[int]) – The minor version. If provided, disables string-based lookups from the major version field.
patch (Optional[int]) – The patch version.
pre (Optional[bool]) – If provided, specifies whether to search pre-releases.
dev (Optional[bool]) – If provided, whether to search dev-releases.
arch (Optional[str]) – If provided, which architecture to search.
name (Optional[str]) – Name of the target python, e.g.
anaconda3-5.3.0
sort_by_path (bool) – Whether to sort by path – default sort is by version(default: False)
- Returns
A new PathEntry pointer at a matching python version, if one can be located.
- Return type
-
reload_system_path
()[source]¶ Rebuilds the base system path and all of the contained finders within it.
This will re-apply any changes to the environment or any version changes on the system.
-
property
system_path
¶
-
property
windows_finder
¶
-