def _get_packages(self, search_path: str, wheelhouse) -> List[Distribution]:
        """Retrieve installed packages from the specified path."""
        if wheelhouse:
            return pm.get_directory_metadata(wheelhouse)
        if sys.executable == search_path:
            return pm.get_installed_metadata() #Distribution.discover()
        else:
            return pm.get_installed_metadata(path=[str(Path(search_path).parent / 'lib' / 'site-packages')]) #distributions(path=[str(Path(search_path).parent / 'lib' / 'site-packages')])
Retrieve installed packages from the specified path.
winpython/piptree.py