原始代码

复制以下代码,保存为txt文件格式

# UTF-8
#
# For more details about fixed file info 'ffi' see:
# http://msdn.microsoft.com/en-us/library/ms646997.aspx
VSVersionInfo(
  ffi=FixedFileInfo(
    # filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
    # Set not needed items to zero 0.
    filevers=(1, 0, 0, 1),
    prodvers=(9, 1, 2, 25096),
    # Contains a bitmask that specifies the valid bits 'flags'r
    mask=0x3f,
    # Contains a bitmask that specifies the Boolean attributes of the file.
    flags=0x0,
    # The operating system for which this file was designed.
    # 0x4 - NT and there is no need to change it.
    OS=0x40004,
    # The general type of file.
    # 0x1 - the file is an application.
    fileType=0x1,
    # The function of the file.
    # 0x0 - the function is not defined for this fileType
    subtype=0x0,
    # Creation date and time stamp.
    date=(0, 0)
    ),
  kids=[
    StringFileInfo(
      [
      StringTable(
        u'080404b0',
        [StringStruct(u'CompanyName', u'XXXXX'),
        StringStruct(u'FileDescription', u'Design By XXXXX'),
        StringStruct(u'FileVersion', u'1.0.0.0'),
        StringStruct(u'ProductName', u'XXXXX'),
        StringStruct(u'ProductVersion', u'1.0.0.1')]),
        StringStruct(u'LegalCopyright', u'Copyright (C) 2019-2025 XXXXX All Rights Reserved')
      ]), 
    VarFileInfo([VarStruct(u'Translation', [2052, 1200])])

原文链接

参数解释

StringStruct(u'CompanyName', u'XXXXX'),  # 公司名称
StringStruct(u'FileDescription', u'Design By XXXXX'), # 文件说明
StringStruct(u'FileVersion', u'1.0.0.0'), # 文件版本,实际生效参数filevers=(9, 1, 2, 25096)
StringStruct(u'ProductName', u'XXXXX'), # 产品名称
StringStruct(u'ProductVersion', u'1.0.01')]) # 产品版本
StringStruct(u'LegalCopyright', u'Copyright (C) 2019-2025 XXXXX All Rights Reserved'), # 版权信息

2.jpg

打包方法

pyinstaller -F --version-file version.txt test.py

Last modification:March 22nd, 2020 at 11:33 am
If you think my article is useful to you, please feel free to appreciate