import sys import os print(__file__) #打印相对路径 base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(base_dir)