How to Solve NameError: name 'Distribution' is not defined -- pkg_resources

Solution: Import the 'Distribution' module

# Add the following line to the top of your code
from pkg_resources import Distribution

 

For more information:
pkg_resources Distribution