from pkg_resources import get_distribution, DistributionNotFound try: version = get_distribution("foo").version except DistributionNotFound: version = "unknown"
Recommended Posts