解决ImportError: No module named utils

Encountered a package import error in Python, in fact, the package already exists.
The reason is that I use a class under the utils package in a.py of the B file,
such as
from utils.RandomErasing import RandomErasing,
but when running under the B file, it will prompt ImportError: No module named utils error.
The final solution is to
add an __init__.py file to the utils file.
I hope it can help you, and hope to persevere on the way to fix the bug.

Related Posts