How to Solve NameError: name 'sysconfig' is not defined

Solution: Import the 'sysconfig' module

# Add the following line to the top of your code
import sysconfig

 

For more information:
Python sysconfig