1、 If the name of the module is the package name created by yourself, as shown in the picture:
1. Add the following code at the top of the file to be run, and the content in quotation marks is the project path:
import sys
sys.path.append(r"C:\Users\Administrator\XXXProjects\XXX")
Note: be sure to write it before all the codes introduced into the module, for example:
2. Add two lines of code in 1 to all imported files, such as runmethod and get in the above figure_ Data and other files need to be added
3. Another method: create a new file base.py, add the following code, and import it before the codes of all imported modules:
import sys
import os
curPath = os.path.abspath(os.path.dirname(__file__))
rootPath = os.path.abspath(os.path.dirname(curPath) + os.path.sep + ".")
sys.path.append(rootPath)
2、 If the module name is a python module, you need to reinstall it, that is, enter the command PIP install XXX in CMD
Read More:
- ModuleNotFoundError: No module named xxx
- Tensorflow operation report error modulenotfounderror: no module named ‘tensorflow. Python. Types’ solution
- Error importing keras in jupyter Notebook: modulenotfounderror: no module named ‘keras’ solution
- ModuleNotFoundError: No module named ‘notebook‘
- ModuleNotFoundError: No module named ‘numpy.testing.nosetester‘
- [Solved] ModuleNotFoundError: No module named ‘win32api’
- Modulenotfounderror: no module named ‘CV2’ – (version problem)
- ModuleNotFoundError: No module named ‘sklearn.datasets.samples_generator‘
- ModuleNotFoundError: No module named ‘tensorflow_core.estimator‘
- ModuleNotFoundError: No module named ‘apt_pkg‘
- ModuleNotFoundError: No module named ‘tensorboardX‘
- ModuleNotFoundError: No module named ‘MySQLdb‘
- ModuleNotFoundError: No module named ‘ahocorasick‘ [100% Work Method]
- ModuleNotFoundError: No module named ‘mmcv._ext
- Mmdet error modulenotfounderror: no module named ‘mmcv_ ext‘
- Module not found error: the solution to the problem of no module named ‘MySQL’
- Importerror: the perfect solution of no module named CV2!!! (not too good)
- Record pyinnstaller package file execution error modulenotfoundererror: no module named ‘cmath’ solution
- Importerror: no module named typing error reporting solution (python2 PIP needs to be backed back from 21)
- Unable to call numpy in pychar, module notfounderror: no module named ‘numpy’