# prints the installed python packages pythonically and not via pip/cmd try: del sys.modules['pkg_resources'] except AttributeError: pass import pkg_resources for resource in pkg_resources.working_set: print( resource )