core.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:Zappa 作者: Miserlou 项目源码 文件源码
def get_installed_packages(site_packages, site_packages_64):
        """
        Returns a dict of installed packages that Zappa cares about.
        """
        import pip  # this is to avoid 'funkiness' with global import
        package_to_keep = []
        if os.path.isdir(site_packages):
            package_to_keep += os.listdir(site_packages)
        if os.path.isdir(site_packages_64):
            package_to_keep += os.listdir(site_packages_64)

        package_to_keep = [x.lower() for x in package_to_keep]

        installed_packages = {package.project_name.lower(): package.version for package in
                              pip.get_installed_distributions()
                              if package.project_name.lower() in package_to_keep
                              or package.location in [site_packages, site_packages_64]}

        return installed_packages
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号