没有合适的资源?快使用搜索试试~ 我知道了~
首页Pyinstaller打包.py生成.exe的方法和报错总结
Pyinstaller 打包.py生成.exe的方法和报错总结 简介 有时候自己写了个python脚本觉得挺好用想要分享给小伙伴,但是每次都要帮他们的电脑装个python环境。虽然说装一下也快,但是相对来说效率还是不高,要是能将python的**.py文件转化为.exe**,那么世界将变得更美好。这篇文章我将简单的介绍如何使用Pyinstaller来打包我们的python脚本。 安装 Pyinstaller pyinstaller的官网为:http://www.pyinstaller.org/ 如果有什么问题一般都能够在这里找到解答。 安装 pyinstaller还是非常的方便的,只需要一句话
资源详情
资源评论
资源推荐

Pyinstaller打包打包.py生成生成.exe的方法和报错总结的方法和报错总结
Pyinstaller 打包打包.py生成生成.exe的方法和报错总结的方法和报错总结
简介简介
有时候自己写了个python脚本觉得挺好用想要分享给小伙伴,但是每次都要帮他们的电脑装个python环境。虽然说装一下也
快,但是相对来说效率还是不高,要是能将python的**.py文件转化为.exe**,那么世界将变得更美好。这篇文章我将简单的介
绍如何使用Pyinstaller来打包我们的python脚本。
安装安装 Pyinstaller
pyinstaller的官网为:http://www.pyinstaller.org/
如果有什么问题一般都能够在这里找到解答。
安装 pyinstaller还是非常的方便的,只需要一句话:
pip install pyinstaller
就OK了
打包打包 Python脚本脚本
关于打包其实也很简单,也只需要一句话:
pyinstaller yourprogram.py
当然pyinstaller命令的语法是:
pyinstaller [options] script [script ...] | spec文件
在运行 pyinstaller命令后在yourprogram.py同一个目录下会产生一个文件两个文件夹:
yourprogram.spec文件,该文件中写了一些配置,可以打开进行修改,下一次可以直接打包该文件,不用打包
yourprogram.py了。
build文件夹,包含一些日志文件和工作文件
dist文件夹,包含可执行文件
1. 控制台窗口选项控制台窗口选项
-c, --console, --nowindowed 打包程序运行时,打开标准i / o控制台窗口(默认)
-w, --windowed, --noconsole 打包程序运行时,不打开标准i / o控制台窗口(默认)
2. 软件图标选项软件图标选项
-i FILE.ico , --icon FILE.ico 为你的程序添加一个图标
3. 版本信息选项版本信息选项
--version-file FILE.txt 可以将您的版本信息添加到你的软件当中
这个FILE.txt的文件内容为:
# UTF-8
#
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=(10, 0, 17134, 1),
prodvers=(10, 0, 17134, 1),
# 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,

















安全验证
文档复制为VIP权益,开通VIP直接复制

评论0