1import pkg_resources
2
3# Get a list of all installed packages
4installed_packages = pkg_resources.working_set
5
6# Create a sorted list of packages and their versions
7installed_packages_list = sorted([f"{i.key}=={i.version}" for i in installed_packages])
8
9# Print the list
10for package in installed_packages_list:
11 print(package)
Created on 8/30/2025