# -*- mode: python -*- block_cipher = None a = Analysis(['bin\\DataCreating_Click.py'], pathex=['E:\\git-code\\dataCreatingGUI'], binaries=[], datas=[], hiddenimports=['PySide6.QtXml'], hookspath=[], runtime_hooks=[], excludes=[], win_no_prefer_redirects=False, win_private_assemblies=False, cipher=block_cipher, noarchive=False) #######!!!注意点1:加载自己的资源文件##################### def extra_datas(mydir): def rec_glob(p, files): import os import glob for d in glob.glob(p): if os.path.isfile(d): files.append(d) rec_glob("%s/*" % d, files) files = [] rec_glob("%s/*" % mydir, files) extra_datas = [] for f in files: extra_datas.append((f, f, 'DATA')) return extra_datas # append the 'Resources' dir a.datas += extra_datas('etc') ###这里是自己的资源文件夹 a.datas += extra_datas('ui') ###这里是自己的资源文件夹 ################################################ pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) exe = EXE(pyz, a.scripts, [], exclude_binaries=True, ###!!!注意点3:这里是True name='dataCreatingGUI', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, console=False) coll = COLLECT(exe, a.binaries, a.zipfiles, a.datas, strip=False, upx=True, name='dataCreatingGUI')