In this article, I am going to show you what are the reasons for this error and how to solve it.


1.The name of the module is incorrect.

The first reason for this error is the name of the module is incorrect, so you have to check out it


2.The path of the module is incorrect.

Probably you would want to import a module file, but this module is not in the same directory. For example, we have a directory. This dictionary has core.py, and the module (module.py), which we want to import, is in another dictionary(folder_1).


core.py
folder_1
---module.py

core.py


import module.py #incorrect

output:

ModuleNotFoundError: No module named 'module'

core.py


import folder_1.module.py #correct

output:


...Program finished with exit code 0

as you can see the problem has been solved


3.The Library Module not installed

Also, you can get the issue if you are trying to import a module which not installed on your virtual. So before you import a module, you have to install it with pip command.

hideoo

English today is not an art to be mastered it's just a tool to use to get a result