Skip to main content

find_package

Find the prefix that a package is installed under, and the path that it would be imported from. The prefix is the directory containing the standard directory hierarchy (lib, bin, etc.). If the package is not installed to the system (:attr:sys.prefix) or a virtualenv (site-packages), None is returned. The path is the entry in :attr:sys.path that contains the package for import. If the package is not installed, it's assumed that the package was imported from the current working directory.

def find_package(
import_name: string
) - > tuple[str | None, str]

Find the prefix that a package is installed under, and the path that it would be imported from.

Parameters

NameTypeDescription
import_namestringThe dot-separated Python import name of the package to locate.

Returns

TypeDescription
`tuple[strNone, str]`