How to Solve modulenotfounderror no module named dataclasses
modulenotfounderror no module named dataclasses is one of the widespread errors that the dataclasses users face.
This article will show you How to solve the error.
Make sure you are using Python 3.7 or above
dataclasses are a new feature of Python 3.7 which means this feature will not work correctly with old version.
However, By using the following commands, you can see the version of Python:
python -V #OR python3 -V
If your version is under 3.7, you need to upgrade your Python. To upgrade Your python, visit How to Upgrade Python.
Make sure you have imported the module
Another reason for the error is that you forget to import the dataclasses. To import the module use the following line:
Install the dataclasses library
As you know the dataclasses module is included in Python 3.7 or above. If you have Python 3.6 you need to install the dataclasses library:
pip install dataclasses