os获取当前路径 os.getcwd() 或者 os.path.dirname(__file__) 方法2有时候报错,用1替代 路径拼接: with open (os.path.join(os.getcwd(), "file_dir", "x.json"),'r') as ff: tags_dict= json.load(ff)