How to Solve NameError: name 'distutils.core' is not defined

Solution: Import the 'distutils.core' module

# Add the following line to the top of your code
import distutils.core

 

For more information:
Python distutils.core