如何为程序添加版本号

首先准备好需要添加版本号的exe程序

然后安装python,并下载pyinstaller

pip install  PyInstaller

将下面内容保存到文档file_version_info.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, 1, 110, 254),
    prodvers=(1, 1, 110, 254),
    # Contains a bitmask that specifies the valid bits 'flags'r
    mask=0x0,
    # 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=0x4,
    # 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(
        '080403a8',
        [StringStruct('Comments', '客户端'),
        StringStruct('CompanyName', ''),
        StringStruct('FileDescription', ''),
        StringStruct('FileVersion', '1.1.110.254'),
        StringStruct('LegalCopyright', 'SIENT Corp.All rights reserved'),
        StringStruct('LegalTrademarks', 'SIENT Corp.All rights reserved'),
        StringStruct('ProductName', '你的程序名称')])
      ]), 
    VarFileInfo([VarStruct('Translation', [2052, 936])])
  ]
)

我的程序版本是1.1.110.254,你需要把代码中的3处版本号都改成你需要的

然后在命令行中运行

pyi-set_version file_version_info.txt文档路径 你的程序路径

完成

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值