0x01 安装
pip install pyinstaller
0x02 常用指令
参数 | 含 义 |
---|---|
-F | 只生成一个exe文件 |
–distpath | 指定生成的exe存放的目录 |
–workpath | 指定编译中临时文件存放的目录 |
-D | 创建一个目录包含:exe文件、依赖文件 |
-i | 指定exe图标 |
-p | 指定exe依赖的包、模块 |
-d | 编译为debug模式,获取运行中的日志信息 |
-clean | 清理编译时临时文件 |
-c | 使用控制台 |
-w | 使用窗口 |
-version-file | 添加exe版本信息 |
0x03 实例
C:\Users\su\Desktop λ pyinstaller.exe -version usage: pyinstaller [-h] [-v] [-D] [-F] [--specpath DIR] [-n NAME] [--add-data] [--add-binary ] [-p DIR] [--hidden-import MODULENAME] [--additional-hooks-dir HOOKSPATH] [--runtime-hook RUNTIME_HOOKS] [--exclude-module EXCLUDES] [--key KEY] [-d [{all,imports,bootloader,noarchive}]] [-s] [--noupx] [-c] [-w] [-i ] [--version-file FILE] [-m ] [-r RESOURCE] [--uac-admin] [--uac-uiaccess] [--win-private-assemblies] [--win-no-prefer-redirects] [--osx-bundle-identifier BUNDLE_IDENTIFIER] [--runtime-tmpdir PATH] [--bootloader-ignore-signals] [--distpath DIR] [--workpath WORKPATH] [-y] [--upx-dir UPX_DIR] [-a] [--clean] [--log-level LEVEL] scriptname [scriptname ...] pyinstaller: error: argument -v/--version: ignored explicit argument 'ersion' C:\Users\su\Desktop λ pyinstaller.exe -F C:\Users\su\Desktop\日志登录IP替换\log_login_ip_replace.py
会在执行目录生成三个文件,其中exe文件在dist目录下

部分详细使用可以参考 https://hoxis.github.io/python-pyinstaller.html