python creates the __init.py__ file to import the module and still reports the error ModuleNotFoundError: No module named 'name'

After customizing the module, exporting from a non-same directory prompts that the module cannot be found. The error message is as follows:

ModuleNotFoundError: No module named 'name'

There are many ways to find the great gods

Reference link

1. Create the folder that needs to be imported __init.py__# Remember to create this folder every time, but this problem is still invalid after trying it
2. Put the file in the python installation directory lib# Too many files have not tried this method

The final solution is as follows:
Right-click the project root directory and mark the directory as the root, so that when py finds the module you want to import, it starts from here.

Is the above method created in PyCharm __init.py__or the solution to the error note

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324622243&siteId=291194637