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
评论列表
文章目录