参考:https://www.cnblogs.com/sengzhao666/p/12748444.html
import tkinter as tk
from tkinter import filedialog
def getLocalFile():
root=tk.Tk()
root.withdraw()
filePath=filedialog.askopenfilename()
print('文件路径:',filePath)
return filePath
if __name__ == '__main__':
getLocalFile()
运行截图: