使用pycharm会遇到这种问题,解决方法
https://stackoverflow.com/questions/338768/python-error-importerror-no-module-named
如果不行的话,添加下面代码进行手动添加
# 获取当前代码文件绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__))
# 将需要导入模块代码文件相对于当前文件目录的绝对路径加入到sys.path中
sys.path.append(os.path.join(current_dir, ".."))