gpt4 book ai didi

python - 如何更新 PyInstaller 生成的 exe 详细信息?

转载 作者:行者123 更新时间:2023-12-02 03:14:30 36 4
gpt4 key购买 nike

我使用 PyInstaller 创建了可执行文件,并希望更新 exe 详细信息,例如 文件描述文件版本

下面是我用过的命令

PyInstaller --onefile --icon=favicon.ico main.spec

我指的是下面详细信息选项卡中显示的属性:

enter image description here

最佳答案

I have solved this by myself with the help of python documentation

1. Create version.rc file

VSVersionInfo(
ffi=FixedFileInfo(
filevers=(ProductVersions),
prodvers=(ProductVersions),
mask=0x3f,
flags=0x0,
OS=0x40004,
fileType=0x1,
subtype=0x0,
date=(0, 0)),
kids=[StringFileInfo([StringTable(
u'040904B0',
[StringStruct(u'FileDescription', u'xyz'),
StringStruct(u'FileVersion', u'1.0.0.0'),
StringStruct(u'InternalName', u'xyz'),
StringStruct(u'LegalCopyright', u'Copyright'),
StringStruct(u'OriginalFilename', u'xyz'),
StringStruct(u'ProductName', u'xyz'),
StringStruct(u'ProductVersion', u'1.0.0.0'),
StringStruct(u'Language', u'Language Neutral'),
StringStruct(u'LegalTrademarks', u'xyz')])]),
VarFileInfo([VarStruct(u'Translation', [1033, 1200])])]
)

2. Create main.spec file and call version.rc file in that

a = Analysis(['main.py'],
pathex=['.'],
binaries=[],
datas=[('data\\*.tsv', 'data')],
hiddenimports=['sklearn.neighbors.typedefs','sklearn.neighbors.quad_tree','sklearn.tree._utils','boto', 'smart_open'],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='xyz',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
runtime_tmpdir=None,
console=True , icon='favicon.ico', version='version.rc')

关于python - 如何更新 PyInstaller 生成的 exe 详细信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56581157/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com