I would like to get a list of Python modules, which are in my Python installation (UNIX server).
How can you get a list of Python modules installed in your computer?
As of pip 10, the accepted answer will no longer work. The development team has removed access to the get_installed_distributions
routine. There is an alternate function in the setuptools
for doing the same thing. Here is an alternate version that works with pip 10:
import pkg_resources
installed_packages = pkg_resources.working_set
installed_packages_list = sorted(["%s==%s" % (i.key, i.version)
for i in installed_packages])
print(installed_packages_list)
Please let me know if it will or won't work in previous versions of pip, too.