Skip to content

Instantly share code, notes, and snippets.

@kotnik
Forked from mtayseer/print_pkg_deps.py
Created May 7, 2014 07:48
Show Gist options
  • Save kotnik/516b2cf1a743abad89de to your computer and use it in GitHub Desktop.
Save kotnik/516b2cf1a743abad89de to your computer and use it in GitHub Desktop.
Print a list of installed packages and their dependencies
import pkg_resources
for pkg in pkg_resources.working_set:
if pkg.requires():
print '{} => {}'.format(pkg.key, ', '.join(req.project_name for req in pkg.requires()))
else:
print pkg.key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment