from pathlib import Path
FILE = Path(__file__).resolve
ROOT_DIR = FILE.parents[2]
if str(ROOT_DIR) not in sys.path: #check if the path exists in the query path to the module
sys.path.append(str(ROOT_DIR))
ROOT_PATH = Path(os.path.relpath(ROOT_DIR,Path.cwd()))
已解决