How to Solve NameError: name 'python_version' is not defined -- platform

Solution: Import the 'python_version' module

To Solve the error, add the following line to the top of your code.

from platform import python_version

 

For more information:
Python platform python_version