python打包加版本信息_使用pyinstaller 2.1将python打包并添加版本信息和图标

这篇博客介绍了如何使用pyinstaller 2.1将Python脚本打包成可执行文件,并添加图标及版本信息。通过pyinstaller的--icon选项设置图标,--version-file选项指定版本信息文件。版本信息文件可通过pyinstaller提供的pyi-grab_version工具从其他.exe文件获取,然后编辑以适应自己的程序。需要注意版本信息文件的编辑应使用合适的编辑器,如notepad++,避免导致文件失效。
摘要由CSDN通过智能技术生成

最近用 wxpython写了一个小的脚本,因为想要发布给没有装python和wxpython的人使用,遂决定使用pyinstaller 2.1进行打包。

其中遇到几个问题:

1,给打包的文件添加图标

查看pyinstaller 的操作手册很容易发现:

-i , -i , --icon=, --icon=

Add an icon to the output executable. Specify an icon FILE.ico to use that icon. Specify an existing .exe file giving the ID to extract the icon with that ID.

可以在使用的时候,在命令行中执行,不过更推荐的是使用bat文件来执行

python pyinstaller.py --icon=targetico_path.ico--onefile   --windowed target_py_file.py进行打包

2,给打包的程序添加版本信息

查看pyinstaller 操作手册发现:

--version-file=version_text_file

Add a Version resource to the .exe output using a version_text_file as produced by pyi-grab_version.

也就是说要添加版本信息需要指定一个版本信息文件,版本信息文件操作手册中也给了制作方法

pyi-grab_versionexecutable_with_version_resource

The pyi-grab_version command is invoked with the full path

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值