clarification
The following presentation assumes a user script and generates results.
Some of the parameters are rarely used and are only listed for brief introduction.Reference to the original text。
common parameter
parameter name | descriptive | clarification |
---|---|---|
-h | Show Help | not have |
-v | Show version number | not have |
–distpath | Where to put the generated files | Default: in the dist folder of the current directory |
–workpath | Where to put the intermediate files in the generation process | Default: in the build folder of the current directory |
-y | If the generated file already exists in the dist folder, it is overwritten without asking the user | Default: Ask to override |
–upx-dir UPX_DIR | Specify the directory for the upx tool | Default: execution path |
-a | Unicode support is not included | Default: unicode support when possible |
–clean | At the start of this compilation, clear the various files generated by the previous compilation | Default: not cleared |
–log-level LEVEL | Controlling what pyi prints at compile time | There are six levels in total, from low to high are TRACE DEBUG INFO (default) WARN ERROR CRITICAL. that is, under the default clear, do not print the TRACE and DEBUG information |
Parameters related to the generation of results
parameter name | descriptive | clarification |
---|---|---|
-D | Program to generate one-folder (default) | The result is a directory where various third-party dependencies, resources and exes are stored at the same time |
-F | Procedures for generating one-file | The result is an exe file into which all third-party dependencies, resources and code are packaged. |
–specpath | Specify the storage path for .spec files | Default: current directory |
-n | Filenames of generated .exe files and .specs | Default: the name of the user script, i.e. the same name as the |
Specify which resources and code to package
parameter name | descriptive | clarification |
---|---|---|
–add-data | Packaging additional resources | Usage: pyinstaller --add-data=src;dest. windows split by ;, linux split by :. |
–add-binary | Packaging Extra Code | Usage: Same as -add-data, except that when a file is added with binary, pyi analyzes the files it references and adds them along with it. |
-p | Specify additional import paths, similar to using PYTHONPATH | See PYTHONPATH |
–hidden-import | Packaging additional py libraries | When pyi is analyzing, some imports are not analyzed correctly and will report an import error when running, you can use the parameter |
–additional-hooks-dir | Specify the user's hook directory | For hook usage, see Other, system hooks are in the PyInstaller\hooks directory. |
–runtime-hook | Specify the user runtime-hook | If this parameter is set, the runtime-hook is run before the |
–exclude-module | Modules to exclude | pyi analyzes a lot of interrelated libraries, but some libraries are not useful to the user and can be excluded with this parameter, which helps to reduce the size of the generated file |
–key | pyi stores the bytecode, specifying the key for encrypting the bytecode | 16-bit string |
Generation parameters
parameter name | descriptive | clarification |
---|---|---|
-d | When executing the generated one, it will output some logs of pyi, which is helpful for error checking. | Default: no output of pyi's logs |
-s | Optimized symbol table | The original article clearly states that it is not recommended for use on windows |
–noupx | Force not to use upx | Default: Use whenever possible. |
(sth. or sb) else
parameter name | descriptive | clarification |
---|---|---|
–runtime-tmpdir | Specify the runtime temporary directory | Default: Use the system temporary directory |
Windows and Mac-specific parameters
parameter name | descriptive | clarification |
---|---|---|
-c | Displaying the Command Line Window | Contrary to -w, this parameter is included by default |
-w | Command line window not displayed | It is useful to use this parameter when writing GUI programs. |
-i | for the specified icon | pyinstaller -i |
Windows-specific parameters
parameter name | descriptive | clarification |
---|---|---|
–version-file | Adding a version information file | pyinstaller --version-file |
-m, --manifest | Adding the manifest file | pyinstaller -m |
-r RESOURCE | Please refer to the original article | |
–uac-admin | Please refer to the original article | |
–uac-uiaccess | Please refer to the original article |
Supplementary: pyinstaller packaging exe common parameters
pyinstaller is a python package that packages python programs into exe files, so that other PCs that do not have python installed can also execute programs written in python.
mounting
pip install pyinstaller
Common Parameters
-D
Generate a folder with the exe file and its dynamic libraries
-F
Generate only exe files
-w
Console not displayed when running exe
-c
Show console when running exe
-i
Adding Icons to Programs
The above is a personal experience, I hope it can give you a reference, and I hope you can support me more. If there is any mistake or something that has not been fully considered, please do not hesitate to give me advice.