1、在需要导入别的类包中加入这两行代码
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))sys.path.append(BASE_DIR)