【Python】Python项目打包发布(一)(基于Pyinstaller打包多目录项目)
【Python】Python项目打包发布(二)(基于Pyinstaller打包PyWebIO项目)
【Python】Python项目打包发布(三)(基于Aardio打包多目录项目)
【Python】Python项目打包发布(四)(基于Nuitka打包PySide6项目)
【Python】Python项目打包发布(五)(制作Windows安装包)
nuitka是一个可以将Python代码转换为C++代码并编译为可执行文件或扩展模块的工具。
Nuitka官网
Nuitka官网中文
Nuitka中文
python venv是一个用于创建和管理虚拟环境的模块。虚拟环境是一种可以在系统中隔离安装Python包的方法,避免与其他项目或系统级别的包发生冲突。
使用python venv的基本步骤如下:
python -m venv
命令,在指定的目录下创建一个虚拟环境,该目录会包含一个Python解释器和一些支持文件。通常,可以将虚拟环境命名为 .venv ,这样可以在终端中隐藏它,并且表明它的用途。source /bin/activate
命令(Linux或MacOS)或call \Scripts\activate.bat
命令(Windows)来激活虚拟环境。这样,就可以在虚拟环境中使用 pip 安装或卸载所需的包了。deactivate
命令来退出虚拟环境。这样,就可以恢复到系统级别的Python解释器和包了。激活虚拟环境后,可以创建或使用requirements文件
pip freeze > requirements.txt
自动生成requirement.txt,执行成功后,会自动生成requirement.txt文件。pip install -r requirements.txt
python -m pip install -U nuitka
安装“ordered-set’”PyPI包以获得最佳的Python编译性能。
python -m pip install -U ordered-set
创建名为 hello.py 的 Python 文件
def talk(message):
return "Talk " + message
def main():
print(talk("Hello World"))
if __name__ == "__main__":
main()
采用python -m nuitka hello.py
方式构建,第一次使用会提示下载一个 C 语言缓存工具GCC(以加速重复编译生成的 C 代码)和一个基于 MinGW64 的 C 语言编译器。选择yes,会自动下载,也可以自己下载。
MinGW64 10.0.0 64位下载
MinGW环境配置,请自行百度
nuitka参数有很多,可以使用nuitka --help
命令查看
可以分为以下几类:
一般选项:用于指定输入文件、输出文件、日志级别、帮助信息等。
编译选项:用于指定编译器、优化级别、调试信息等。
控制结果中包含的模块和包:用于指定要包含或排除的模块和包,以及是否使用标准库等。
控制结果中包含的数据文件:用于指定要包含或排除的数据文件,以及是否使用资源压缩等。
插件选项:用于启用或禁用一些特定功能的插件,例如Qt、Tkinter、multiprocessing等。
其他选项:用于指定一些其他功能,例如图形界面、生成依赖关系图、检查更新等。
您可以使用 nuitka --help 命令查看所有参数的详细说明。
以下是之前版本参数的参考,最新请自行官网学习
--mingw64 #默认为已经安装的vs2017去编译,否则就按指定的比如mingw(官方建议)
--standalone 独立环境,这是必须的(否则拷给别人无法使用)
--windows-disable-console 没有CMD控制窗口
--output-dir=out 生成exe到out文件夹下面去
--show-progress 显示编译的进度,很直观
--show-memory 显示内存的占用
--include-qt-plugins=sensible,styles 打包后PyQt的样式就不会变了
--plugin-enable=qt-plugins 需要加载的PyQt插件
--plugin-enable=tk-inter 打包tkinter模块的刚需
--plugin-enable=numpy 打包numpy,pandas,matplotlib模块的刚需
--plugin-enable=torch 打包pytorch的刚需
--plugin-enable=tensorflow 打包tensorflow的刚需
--windows-icon-from-ico=你的.ico 软件的图标
--windows-company-name=Windows下软件公司信息
--windows-product-name=Windows下软件名称
--windows-file-version=Windows下软件的信息
--windows-product-version=Windows下软件的产品信息
--windows-file-description=Windows下软件的作用描述
--windows-uac-admin=Windows下用户可以使用管理员权限来安装
--linux-onefile-icon=Linux下的图标位置
--onefile 像pyinstaller一样打包成单个exe文件
--include-package=复制比如numpy,PyQt5 这些带文件夹的叫包或者轮子
--include-module=复制比如when.py 这些以.py结尾的叫模块
项目requirements.txt
beautifulsoup4==4.11.2
bs4==0.0.1
certifi==2022.12.7
charset-normalizer==3.0.1
idna==3.4
Nuitka==1.4.8
numpy==1.24.2
ordered-set==4.1.0
PySide6==6.4.2
PySide6-Addons==6.4.2
PySide6-Essentials==6.4.2
requests==2.28.2
shiboken6==6.4.2
soupsieve==2.4
urllib3==1.26.14
项目结构
set pythonpath=venv\Lib\site-packages
执行命令
nuitka --mingw64 --standalone --windows-disable-console --show-memory --show-progress --plugin-enable=pyside6 --nofollow-import-to=tkinter,mpl_toolkits --plugin-enable=tk-inter --windows-icon-from-ico=logo.ico --output-dir=o main.py
nuitka.utils.Execution.NuitkaCalledProcessError: Command ‘[‘venv\Scripts\python.exe’, ‘-c’, ‘\\nfrom future import print_function\nfrom future import absolute_import\n\ntry:\n import os, sys\n library_path = os.path.join(“Library”, “bin”) if os.name == “nt” else “lib”\n library_prefix = “mkl_” if os.name == “nt” else “libmkl_”\nexcept ImportError:\n import sys\n sys.exit(38)\nprint(repr([os.path.join(sys.prefix, library_path, filename)\n for filename in os.listdir(os.path.join(sys.prefix, library_path))\n if filename.startswith(library_prefix)]\n))\nprint(“-” * 27)\n’]’ returned non-zero exit status 1. Error was b’Traceback (most recent call last):\r\n File “”, line 13, in \r\nFileNotFoundError: [WinError 3] \xcf\xb5\xcd\xb3\xd5\xd2\xb2\xbb\xb5\xbd\xd6\xb8\xb6\xa8\xb5\xc4\xc2\xb7\xbe\xb6\xa1\xa3: ‘zssw\\venv\\Library\\bin’'.
根据您提供的错误信息,问题似乎出在 FileNotFoundError: [WinError 3]。这意味着程序在尝试访问一个不存在的文件或目录。在这种情况下,它似乎是在寻找 \venv\Library\bin 这个目录,但没有找到。
解决方法:
将conda目录下的libary复制到venv下
可以在dist文件夹生成之后,将icon文件复制进去,使用EVB封包
–help
显⽰此帮助信息并退出
–version
显⽰版本信息和提交 bug 报告所需的重要细节,然后退出。默认关闭。
–module
创建⼀个扩展模块可执⾏⽂件,⽽不是⼀个程序。默认关闭。
–standalone
启⽤独⽴模式输出。这允许您将创建的⼆进制⽂件转移到其他机器上,⽽不需要现有的 Pyth
on 安装。这也意味着它会变⼤。它隐含了这些选项: - follow-imports 和 - python-fla
g=no_site 。默认关闭。
–onefile
在独⽴模式的基础上,启⽤ onefile 模式。这意味着创建并使⽤的不是⼀个⽂件夹,⽽是
⼀个压缩的可执⾏⽂件。默认关闭。
–python-debug
是否使⽤ debug 版本。默认使⽤您⽤来运⾏ Nuitka 的版本,很可能是⾮ debug 版本。
–python-flag=FLAG
要使⽤的 Python 标志。默认是您⽤来运⾏ Nuitka 的标志,这强制执⾏⼀个特定的模式。这些
选 项 也 存 在 于 标 准 Python 可 执 ⾏ ⽂ 件 中 。 当 前 ⽀ 持 的 有 : “-S” ( alias
“no_site”),“static_hashes”(不使⽤散列随机化),“no_warnings”(不给出 Python 运⾏时警
告),“-O” (alias “no_asserts” ),“no_docstrings” (不使⽤⽂档字符串),“-u” (alias
“unbuffered”)和"-m"。默认为空。
–python-for-scons=PATH
如果使⽤ Python3.3 或 Python3.4,提供⼀个 Python ⼆进制⽂件的路径供 Scons 使⽤。否则
Nuitka 可以使⽤您⽤来运⾏ Nuitka 的⼆进制⽂件或从 Windows 注册表中获取⼀个 Python 安
装。在 Windows 上需要 Python 3.5或更⾼版本。在⾮ Windows 上,Python 2.6 或 2.7 也可以。
–include-package=PACKAGE
包含⼀个完整的包。提供为⼀个 Python 命名空间,例如 " some_package.sub_packag
e “,然后 Nuitka 会找到它,并将其及其下⾯找到的所有模块包含在它创建的⼆进制⽂件或扩
展模块中,并使代码可以导⼊它。为了避免不需要的⼦包,例如测试,您可以这样做” - nofoll
ow-import-to=*.tests "。默认为空。
使⽤这个选项后,所有在 PACKAGE 中被列出来的包,例如 - include-package=av,PySi
de6,faster_whisper,transformers,ctranslate2 ,所有这些包都 将会被完整编译,这将
增加编译时间,同时可能解决⼀部分编译后出现模块或者⼦模块⽆法找到的错误,例如: Model
FoundError 、 importError 、 No model Named XXXX 。
–include-module=MODULE
包含⼀个单⼀的模块。提供为⼀个 Python 命名空间,例如 " some_package.some_modul
e ",然后 Nuitka 会找到它,并将其包含在它创建的⼆进制⽂件或扩展模块中,并使代码可以导
⼊它。默认为空。
–include-plugin-directory=MODULE/PACKAGE
在该⽬录中找到的代码也将被包含,就像它们每个都作为主⽂件给出⼀样。覆盖所有其他包
含选项。您应该更喜欢按名称⽽不是⽂件名的其他包含选项,因为它们通过在“sys.path”中来查
找东西。这个选项仅⽤于⾮常特殊的使⽤案例。可以多次给定。默认为空。
–include-plugin-files=PATTERN
包含匹配 PATTERN 的⽂件。覆盖所有其他 follow 选项。可以多次给出。默认为空。
–prefer-source-code
对于已经编译的扩展模块,如果同时存在源⽂件和扩展模块,通常使⽤扩展模块,但从可⽤
的源代码编译模块性能最佳。如果不需要,使⽤ - no-prefer-source-code 来禁⽤关于此的
警告。默认关闭。
–follow-imports
递归到所有导⼊的模块。在 - standalone 模式下默认开启,否则关闭。
–follow-import-to=MODULE/PACKAGE
如果使⽤了这个模块,或者如果是⼀个包,跟踪到整个包。可以多次给出。默认为空。
–nofollow-import-to=MODULE/PACKAGE
即使使⽤了也不跟踪这个模块,或者如果是⼀个包,在任何情况下也不跟踪整个包,覆盖所有
其他选项。可以多次给出。默认为空。
–nofollow-imports
完全不递归到任何导⼊的模块,覆盖所有其他包含选项,不能⽤于独⽴模式。默认关闭。
–follow-stdlib
递归到标准库中导⼊的模块。这将极⼤地增加编译时间,⽬前也没有很好地测试过,有时也不
起作⽤。默认关闭。
–onefile-tempdir-spec=ONEFILE_TEMPDIR_SPEC
在 onefile 模式下解压缩到此⽂件夹。默认 ‘%TEMP%/onefile_%PID%_%TIME% ,即⽤
⼾临时⽬录,由于不是静态的,退出时会被删除。例如,使⽤类似’ CACHE_DIR%/%COMPANY%/%
PRODUCT%/%VERSION% 的字符串,这是⼀个很好的静态缓存路径,因此不会被删除。
–onefile-child-grace-time=GRACE_TIME_MS
当停⽌⼦进程时,例如由于 CTRL-C 或关闭等, Python 代码会收到⼀个 KeyboardInte
rrupt ,它可以处理,例如刷新数据。这是在硬关闭⼦进程前的宽限时间(单位毫秒)。默认值
为 。
–include-package-data=PACKAGE
包含给定包名的数据⽂件。 DLL 和扩展模块不是数据⽂件,不会像这样包含。可以像下⾯
指⽰的那样使⽤通配符。默认情况下不包含包的数据⽂件,但包配置可以做到这⼀点。这只会包
含⾮ DLL 、⾮扩展模块的实际数据⽂件。冒号后可选地可以给出⼀个⽂件名模式,仅选择匹配
的⽂件。例⼦:
include-package-data=package_name (所有⽂件)
include-package-data=package_name=.txt (仅某种类型)
-include-package-data=package_name=some_filename.dat ( 具 体 ⽂ 件 ) 默 认 为
空。
–include-data-files=DESC
通过发⾏版中的⽂件名包含数据⽂件。有许多允许的形式。
使⽤ - include-data-files=/path/to/file/.txt=folder_name/some.txt 它会复
制⼀个单⼀⽂件,如果是多个会抱怨。
使⽤ - include-data-files=/path/to/files/.txt=folder_name/ 它会把所有匹配
的⽂件放⼊那个⽂件夹。
要进⾏递归复制,有⼀个带 个值的表单,即 - include-data-files=/path/to/scan=f
older_name=**/.txt 这会保留⽬录结构。默认为空。
–include-data-dir=DIRECTORY
从发⾏版中包含完整的⽬录中的数据⽂件。这是递归的。如果您想要⾮递归包含,请使⽤带
通配符的 - include-data-files 。⼀个例⼦是 - include-data-dir=/path/some_dir=d
ata/some_dir ,⽤于简单复制整个⽬录。所有⽂件都将被复制,如果您想排除⽂件,您需要事
先将其删除,或使⽤ - noinclude-data-files 选项将其删除。默认为空。
–noinclude-data-files=PATTERN
不要包含匹配给定的⽂件名模式的数据⽂件。这是针对⽬标⽂件名,⽽不是源路径。因此,
要忽略来⾃ package_name 的数据⽂件的⽂件模式,应匹配为 package_name/*.txt 。或者
对于整个⽬录,简单地使⽤ package_name 。默认为空。
–list-package-data=LIST_PACKAGE_DATA
输出为给定包名找到的数据⽂件。默认不执⾏。
–noinclude-dlls=PATTERN
不要包含匹配给定的⽂件名模式的 DLL ⽂件。这是针对⽬标⽂件名,⽽不是源路径。因
此,要忽略包含在包 package_name 中的某个 DLL “someDLL”,应匹配为 package_name/s
omeDLL.* 。默认为空。
–list-package-dlls=LIST_PACKAGE_DLLS
输出为给定包名找到的 DLL。默认不执⾏。
–warn-implicit-exceptions
启⽤对编译时检测到的隐式异常的警告。
–warn-unusual-code
启⽤对编译时检测到的不寻常代码的警告。
–assume-yes-for-downloads
允许Nuitka在必要时下载外部代码,例如dependency walker, ccache,甚⾄在Windows上
是gcc。要禁⽤,从空设备重定向输⼊,例如" –nowarn-mnemonic=MNEMONIC
禁⽤给定助记符的警告。这些是为了确保您知道某些主题,通常指向 Nuitka ⽹站。助记符是
URL 末尾的部分,没有 HTML 后缀。可以多次给出,并接受 shell 模式。默认为空。
–run
⽴即执⾏创建的⼆进制⽂件(或导⼊编译后的模块)。默认关闭。
–debugger
在调试器中执⾏,例如 " gdb " 或 " lldb " 以⾃动获取堆栈跟踪。默认关闭。
–execute-with-pythonpath
当使⽤ - run ⽴即执⾏创建的⼆进制⽂件或模块时,不重置 PYTHONPATH 环境变量。当所
有模块都成功包含时,您不应该需要 PYTHONPATH 了,对于独⽴模式尤其如此。
–user-package-configuration-file=YAML_FILENAME
⽤⼾提供的带有包配置的 Yaml ⽂件。您可以包含 DLL、删除臃肿、添加隐藏依赖项。有关要
使⽤的格式的完整描述,请查看⽤⼾⼿册。可以多次给出。默认为空。
–full-compat
强制与 CPython 绝对兼容。甚⾄不允许与 CPython ⾏为的轻微偏差,例如没有更好的回溯或
异常消息,这些并不是真的不兼容,只是不同或更差。这仅⽤于测试,不应使⽤。
–file-reference-choice=MODE
选择“file”将采⽤的值。对于“运⾏时”(独⽴⼆进制模式和模块模式的默认值),创建的⼆进
制⽂件和模块使⽤它们⾃⼰的位置来推断“file”的值。包含的包假装在该位置下⾯的⽬录中。这允
许您在部署中包含数据⽂件。如果您仅仅是寻求加速,那么使⽤“原始”值会对您更好,其中将使
⽤源⽂件的位置。使⽤“冻结”时,使⽤类似“”的标记。为了兼容性,
“file”的值将始终具有“.py”后缀,⽆论它实际上是什么。
–module-name-choice=MODE
选择“name”和“package”将采⽤的值。对于“运⾏时”(模块模式的默认值),创建的模块使
⽤⽗包来推断“package”的值,以保持完全兼容。“原始”的值(其他模式的默认值)允许进⾏更静
态的优化,但对于可以加载到任何包中的模块不兼容。
–output-filename=FILENAME
指定如何命名可执⾏⽂件。对于扩展模块没有选择,也不⽤于独⽴模式,使⽤它将是⼀个错
误。这可能包括需要存在的路径信息。默认为此平台上的可执⾏⽂件格式,如: “
–output-dir=DIRECTORY
指定应将中间和最终输出⽂件放⼊的位置。该⽬录将填充构建⽂件夹、 dist ⽂件夹、⼆进
制⽂件等。默认为当前⽬录。
–remove-output
⽣成模块或可执⾏⽂件后删除构建⽬录。默认关闭。
–no-pyi-file
为 Nuitka 创建的扩展模块不要创建 .pyi ⽂件。这⽤于检测隐式导⼊。默认关闭。
–debug
执⾏所有可能的⾃检以查找 Nuitka 中的错误,不要⽤于⽣产。默认关闭。
–unstripped
在⽣成的对象⽂件中保留调试信息,以获得更好的调试器交互。默认关闭。
–profile
启⽤基于 vmprof 的编译时间概要分析。当前不⼯作。默认关闭。
–internal-graph
创建优化过程内部的图。不要⽤于整个程序,仅⽤于⼩的测试⽤例。默认关闭。
–trace-execution
跟踪执⾏输出,在执⾏每⾏代码之前输出该⾏。默认关闭。
–recompile-c-only
这不是增量编译,⽽仅⽤于 Nuitka 开发。获取现有⽂件并简单地再次将它们编译为 C。允许
编译编辑后的 C ⽂件以快速调试⽣成的源代码中的更改,例如看代码是否通过,输出的值等,默
认关闭。取决于编译 Python 源代码以确定应查看的⽂件。
–xml=XML_FILENAME
将内部程序结构,优化结果以 XML 形式写⼊给定的⽂件名。
–generate-c-only
仅⽣成 C 源代码,不编译为⼆进制⽂件或模块。这是为了调试和代码覆盖分析,不会浪费
CPU。默认关闭。不要认为您可以直接使⽤它。
–experimental=FLAG
使⽤标记为“实验性”的功能。如果没有实验性功能存在于代码中,可能没有效果。每个实验
功能使⽤秘密标签(检查源代码)。
–low-memory
尝试使⽤更少的内存,通过派⽣较少的 C 编译作业和使⽤较少内存的选项。⽤于嵌⼊式机器。
如果出现内存不⾜的问题,请使⽤此选项。默认关闭。
–create-environment-from report=CREATE_ENVIRONMENT_FROM_REPORT
从给定报告⽂件(例如“–report=compilation-report.xml”)创建给定不存在路径上的新
virtualenv。默认不执⾏。
–clang
强制使⽤ clang。在 Windows上,这需要⼀个有效的 Visual Studio 版本进⾏⽀持。默认关
闭。
–mingw64
在 Windows 上强制使⽤ MinGW64。默认关闭,除⾮使⽤带 MinGW Python 的 MSYS2。与
clang 命令⼀起使⽤就可以使⽤ MSYS2 的 clang 编译器,否则即使指定了 - clang 参数
也将使⽤ MSVC 版本的 clang 编译器。
–msvc=MSVC_VERSION
在 Windows上强制使⽤特定的 MSVC 版本。允许的值例如“14.3”(MSVC 2022)和其他
MSVC 版本号,指定“list”获取已安装编译器的列表,或使⽤“latest”。如果已安装,默认为最新的
MSVC,否则使⽤ MinGW64。
–jobs=N
指定允许的并⾏ C 编译器作业数。默认为系统 CPU 数。
–lto=choice
使⽤链接时间优化(MSVC,gcc,clang)。允许的值为“yes”、“no”和“auto”(已知⼯作
时)。默认为“auto”。
–static-libpython=choice
使⽤ Python 的静态链接库。允许的值为“yes”、“no”和“auto”(已知⼯作时)。默认为
“auto”。
–disable-cache=DISABLED_CACHES
禁⽤所选缓存,指定 all 表⽰全部缓存。当前允许的值有: all , ccache , bytecod
e , dll-dependencies 。可以多次给出或⽤逗号分隔的值。
默认不开启。
–clean-cache=CLEAN_CACHES
在执⾏之前清除给定的缓存,指定 all 表⽰全部缓存。当前允许的值有: all , ccach
e , bytecode , dll-dependencies 。可以多次给出或⽤逗号分隔的值。
默认不开启。
–disable-bytecode-cache
不要重⽤标准库中包含的字节码的模块的依赖关系分析结果。与 - disable-cache=bytec
ode 相同。
–disable-ccache
不要试图使⽤ ccache ( gcc 、 clang 等)或 clcache ( MSVC 、 clangcl )。与 disable-cache=ccache 相同。
–disable-dll-dependency-cache
禁⽤依赖项⾏⾛器缓存。这将导致创建发⾏版⽂件夹时间⼤⼤增加,但可能在缓存可能导致
错误时使⽤。与 - disable-cache=dll-dependencies 相同。
–force-dll-dependency-cache-update
强制更新依赖项⾏⾛器缓存。这将导致创建发⾏版⽂件夹时间⼤⼤增加,但在怀疑缓存导致
错误或已知需要更新时可能会使⽤。
–pgo
启⽤C级别的基于Profile的优化(PGO),通过⾸先执⾏⼀个专⻔的构建进⾏分析运⾏,然后
使⽤结果反馈到C编译中。注意:这是实验性的,在 Nuitka 的独⽴模式下还不⼯作。默认关闭。
–pgo-args=PGO_ARGS
在进⾏基于Profile的优化时要传递的参数。这些在 PGO 分析运⾏期间传给特殊构建的可执⾏
⽂件。默认为空。
–pgo-executable=PGO_EXECUTABLE
收集配置⽂件信息时要执⾏的命令。仅在需要通过脚本启动它时使⽤。默认使⽤创建的程
序。
–report=REPORT_FILENAME
在 XML 输出⽂件中报告模块、数据⽂件、编译、插件等详细信息。这在问题报告中也⾮常有
⽤。例如,这些报告可以与“–create-environment-from-report”⼀起使⽤,轻松重新创建环
境,但包含⼤量信息。默认关闭。
–report-template=REPORT_DESC
通过模板报告。提供模板和输出⽂件名"template.rst.j2:output.rst"。对于内置模板,请查
看⽤⼾⼿册以了解这些模板。可以多次给定。默认为空。
–quiet
禁⽤所有信息输出,但显⽰警告。默认关闭。
–show-scons
使⽤详细信息运⾏ C 构建后端 Scons,显⽰执⾏的命令、检测到的编译器。默认关闭。
–no-progressbar
禁⽤进度条。默认关闭。
–show-progress
已废弃:提供编译进度信息和统计信息。禁⽤正常的进度条。默认关闭。
–show-memory
提供内存信息和统计信息。默认关闭。
–show-modules
提供包含的模块和 DLL 的信息。已废弃:您应该改⽤ ‘–report’ ⽂件。默认关闭。
–show-modules-output=PATH
show-modules 的输出位置,应该是⼀个⽂件名。默认是标准输出。
–verbose
输出所采取操作的详细信息,尤其是优化⽅⾯。可以变得很多。默认关闭。
–verbose-output=PATH
verbose 的输出位置,应该是⼀个⽂件名。默认是标准输出。
–disable-console
当为 Windows 或 macOS 编译时,禁⽤控制台窗⼝并创建 GUI 应⽤程序。默认关闭。
–enable-console
当为 Windows 或 macOS 编译时,启⽤控制台窗⼝并创建控制台应⽤程序。这会禁⽤某些模
块的提⽰,例如“PySide”,它建议禁⽤它。默认为 true。
–force-stdout-spec=FORCE_STDOUT_SPEC
强制程序的标准输出到此位置。对于禁⽤了控制台的程序以及使⽤ Nuitka商业版的
Windows 服务插件的程序很有⽤。默认不活动,例如使⽤’%PROGRAM%.out.txt’,即靠近程序
的⽂件。
–force-stderr-spec=FORCE_STDERR_SPEC
强制程序的标准错误输出到此位置。对于禁⽤了控制台的程序以及使⽤ Nuitka商业版的
Windows 服务插件的程序很有⽤。默认不活动,例如使⽤’%PROGRAM%.err.txt’,即靠近程序
的⽂件。
–windows-icon-from-ico=ICON_PATH
添加可执⾏⽂件图标。可以多次给定不同分辨率或包含多个图标的⽂件。在后⼀种情况下,
您还可以⽤ # 作为后缀,其中 n 是从 1 开始的整数索引,指定要包含的特定图标,忽略所有其他
图标。
–windows-icon-from-exe=ICON_EXE_PATH
从这个已存在的可执⾏⽂件(仅Windows)复制可执⾏⽂件图标。
–onefile-windows-splash-screen image=SPLASH_SCREEN_IMAGE
当为 Windows 和 onefile 编译时,加载应⽤程序时显⽰此内容。默认关闭。
–windows-uac-admin
请求 Windows ⽤⼾控制,在执⾏时授予管理权限。(仅Windows)。默认关闭。
–windows-uac-uiaccess
请求 Windows ⽤⼾控制,强制仅从少数⽂件夹运⾏,远程桌⾯访问。(仅Windows)。默
认关闭。
–macos-target-arch=MACOS_TARGET_ARCH
这应该在哪些体系结构上运⾏。默认和限制是运⾏ Python 允许的。默认是“native”,即⽤来
运⾏ Python 的体系结构。
–macos-create-app-bundle
当为 macOS 编译时,创建⼀个包⽽不是⼀个普通的⼆进制应⽤程序。⽬前还在实验和不完
整。⽬前这是解锁禁⽤控制台的唯⼀⽅法。默认关闭。
–macos-app-icon=ICON_PATH
为应⽤程序包添加图标。只能给⼀次。默认为可⽤的 Python 图标。
–macos-signed-app-name=MACOS_SIGNED_APP_NAME
⽤于 macOS 签名的应⽤程序名称。遵循 “com.YourCompany.AppName” 命名约定可以获得
最佳效果,因为这些必须是全局唯⼀的,并有可能授予受保护的 API 访问权限。
–macos-app-name=MACOS_APP_NAME
要在 macOS 包信息中使⽤的产品名称。默认为⼆进制⽂件的基本⽂件名。
–macos-app-mode=MODE
应⽤程序包的应⽤模式。当启动窗⼝并希望出现在 Docker 中时,默认值“gui”很合适。如果
从不启动窗⼝,应⽤程序是⼀个“后台”应⽤程序。对于稍后显⽰的 UI 元素,“ui-element” 介于两
者之间。该应⽤程序不会出现在 dock 中,但在打开窗⼝时可以完全访问桌⾯。
–macos-sign-identity=MACOS_APP_VERSION
在 macOS 上签名时,默认情况下将使⽤临时标识,但使⽤此选项可以指定要使⽤的其他标
识。代码签名在 macOS 上现在是强制性的,不能禁⽤。如果未给出,默认为“临时”。
–macos-sign-notarization
在为公证签名时,使⽤来⾃ Apple 的适当 TeamID 标识,使⽤所需的运⾏时签名选项,以便
可以被接受。
–macos-app-version=MACOS_APP_VERSION
要在 macOS 包信息中使⽤的产品版本。如果未给出,默认为“1.0”。
–macos-app-protected-resource=RESOURCE_DESC
请求访问 macOS 保护资源的权限,例如
“NSMicrophoneUsageDescription:Microphone access for recording audio.” 请求⻨克⻛访
问权限并为⽤⼾提供⼀个信息性⽂本,并解释为什么需要它。冒号前是⼀个操作系统标识符,⽤
于访问权限,然后是信息性⽂本。法律值可以在 Apple Developer 上找到,该选项可以指定多
次。默认为空。
–linux-icon=ICON_PATH
为 onefile ⼆进制⽂件添加可执⾏⽂件图标使⽤。只能给⼀次。默认为可⽤的 Python 图标。
⼆进制版本信息:
–company-name=COMPANY_NAME
要在版本信息中使⽤的公司名称。默认未使⽤。
–product-name=PRODUCT_NAME
要在版本信息中使⽤的产品名称。默认为⼆进制⽂件的基本⽂件名。
–file-version=FILE_VERSION
要在版本信息中使⽤的⽂件版本。必须是最多4个数字的序列,例如 1.0 或 1.0.0.0,不允许更
多数字,不允许字符串。默认未使⽤。
–product-version=PRODUCT_VERSION
要在版本信息中使⽤的产品版本。与⽂件版本相同的规则。默认未使⽤。
–file-description=FILE_DESCRIPTION
版本信息中使⽤的⽂件说明。⽬前仅Windows。默认为⼆进制⽂件名。
–copyright=COPYRIGHT_TEXT
版本信息中使⽤的版权。⽬前仅Windows。默认不显⽰。
–trademarks=TRADEMARK_TEXT
版本信息中使⽤的商标。⽬前仅Windows。默认不显⽰。
–enable-plugin=PLUGIN_NAME
启⽤的插件。必须是插件名称。使⽤’–plugin-list’查询完整列表并退出。默认为空。
–disable-plugin=PLUGIN_NAME
禁⽤的插件。必须是插件名称。使⽤’–plugin-list’查询完整列表并退出。禁⽤⼤多数标准插
件通常不是⼀个好主意。默认为空。
–plugin-no-detection
插件可以检测它们是否可能被使⽤,然后您可以通过"–disable-plugin=plugin-that warned"禁⽤警告,或者您可以使⽤此选项完全禁⽤该机制,这当然也略微加快了编译速度。默
认关闭。
–plugin-list
显⽰所有可⽤插件的列表并退出。默认关闭。
–user-plugin=PATH
⽤⼾插件的⽂件名。可以多次给出。默认为空。
–show-source-changes
显⽰编译前对原始 Python ⽂件内容的更改。主要⽤于开发插件。默认为 False。
–show-anti-bloat-changes
注释插件所做的更改。
–noinclude-setuptools-mode=NOINCLUDE_SETUPTOOLS_MODE
如果遇到 ‘setuptools’ 或导⼊,该怎么办。这个包可以带有依赖项变⼤,绝对应该避免。还
处理 ‘setuptools_scm’。
–noinclude-pytest-mode=NOINCLUDE_PYTEST_MODE
如果遇到 ‘pytest’ 导⼊,该怎么办。这个包可以带有依赖项变⼤,绝对应该避免。还处理
‘nose’ 导⼊。
–noinclude-unittest-mode=NOINCLUDE_UNITTEST_MODE
如果遇到 unittest 导⼊,该怎么办。这个包可以带有依赖项变⼤,绝对应该避免。
–noinclude-IPython-mode=NOINCLUDE_IPYTHON_MODE
如果遇到 IPython 导⼊,该怎么办。这个包可以带有依赖项变⼤,绝对应该避免。
–noinclude-dask-mode=NOINCLUDE_DASK_MODE
如果遇到 ‘dask’ 导⼊,该怎么办。这个包可以带有依赖项变⼤,绝对应该避免。
–noinclude-numba-mode=NOINCLUDE_NUMBA_MODE
如果遇到 ‘numba’ 导⼊,该怎么办。这个包可以带有依赖项变⼤,⽬前对独⽴模式不起作
⽤。这个包可以带有依赖项变⼤,绝对应该避免。
–noinclude-default-mode=NOINCLUDE_DEFAULT_MODE
这实际上为上述选项提供了默认的“警告”值,并可⽤于打开所有这些。
–noinclude-custom-mode=CUSTOM_CHOICES
如果遇到特定导⼊,该怎么办。格式为模块名称,可以并且应该是⼀个顶层包,然后是⼀个
选择,“error”、“warning”、“nofollow”,例如 PyQt5:error。
Options:
--help show this help message and exit
--version Show version information and important details for bug
reports, then exit. Defaults to off.
--module Create an extension module executable instead of a
program. Defaults to off.
--standalone Enable standalone mode for output. This allows you to
transfer the created binary to other machines without
it using an existing Python installation. This also
means it will become big. It implies these option: "--
follow-imports" and "--python-flag=no_site". Defaults
to off.
--onefile On top of standalone mode, enable onefile mode. This
means not a folder, but a compressed executable is
created and used. Defaults to off.
--python-debug Use debug version or not. Default uses what you are
using to run Nuitka, most likely a non-debug version.
--python-flag=FLAG Python flags to use. Default is what you are using to
run Nuitka, this enforces a specific mode. These are
options that also exist to standard Python executable.
Currently supported: "-S" (alias "no_site"),
"static_hashes" (do not use hash randomization),
"no_warnings" (do not give Python run time warnings),
"-O" (alias "no_asserts"), "no_docstrings" (do not use
doc strings), "-u" (alias "unbuffered") and "-m".
Default empty.
--python-for-scons=PATH
If using Python3.3 or Python3.4, provide the path of a
Python binary to use for Scons. Otherwise Nuitka can
use what you run Nuitka with or a Python installation
from Windows registry. On Windows Python 3.5 or higher
is needed. On non-Windows, Python 2.6 or 2.7 will do
as well.
Control the inclusion of modules and packages in result:
--include-package=PACKAGE
Include a whole package. Give as a Python namespace,
e.g. "some_package.sub_package" and Nuitka will then
find it and include it and all the modules found below
that disk location in the binary or extension module
it creates, and make it available for import by the
code. To avoid unwanted sub packages, e.g. tests you
can e.g. do this "--nofollow-import-to=*.tests".
Default empty.
--include-module=MODULE
Include a single module. Give as a Python namespace,
e.g. "some_package.some_module" and Nuitka will then
find it and include it in the binary or extension
module it creates, and make it available for import by
the code. Default empty.
--include-plugin-directory=MODULE/PACKAGE
Include also the code found in that directory,
considering as if they are each given as a main file.
Overrides all other inclusion options. You ought to
prefer other inclusion options, that go by names,
rather than filenames, those find things through being
in "sys.path". This option is for very special use
cases only. Can be given multiple times. Default
empty.
--include-plugin-files=PATTERN
Include into files matching the PATTERN. Overrides all
other follow options. Can be given multiple times.
Default empty.
--prefer-source-code
For already compiled extension modules, where there is
both a source file and an extension module, normally
the extension module is used, but it should be better
to compile the module from available source code for
best performance. If not desired, there is --no-
prefer-source-code to disable warnings about it.
Default off.
Control the following into imported modules:
--follow-imports Descend into all imported modules. Defaults to on in
standalone mode, otherwise off.
--follow-import-to=MODULE/PACKAGE
Follow to that module if used, or if a package, to the
whole package. Can be given multiple times. Default
empty.
--nofollow-import-to=MODULE/PACKAGE
Do not follow to that module name even if used, or if
a package name, to the whole package in any case,
overrides all other options. Can be given multiple
times. Default empty.
--nofollow-imports Do not descend into any imported modules at all,
overrides all other inclusion options and not usable
for standalone mode. Defaults to off.
--follow-stdlib Also descend into imported modules from standard
library. This will increase the compilation time by a
lot and is also not well tested at this time and
sometimes won't work. Defaults to off.
Onefile options:
--onefile-tempdir-spec=ONEFILE_TEMPDIR_SPEC
Use this as a folder to unpack to in onefile mode.
Defaults to '%TEMP%/onefile_%PID%_%TIME%', i.e. user
temporary directory and being non-static it's removed.
Use e.g. a string like
'%CACHE_DIR%/%COMPANY%/%PRODUCT%/%VERSION%' which is a
good static cache path, this will then not be removed.
--onefile-child-grace-time=GRACE_TIME_MS
When stopping the child, e.g. due to CTRL-C or
shutdown, etc. the Python code gets a
"KeyboardInterrupt", that it may handle e.g. to flush
data. This is the amount of time in ms, before the
child it killed in the hard way. Unit is ms, and
default 5000.
Data files:
--include-package-data=PACKAGE
Include data files for the given package name. DLLs
and extension modules are not data files and never
included like this. Can use patterns the filenames as
indicated below. Data files of packages are not
included by default, but package configuration can do
it. This will only include non-DLL, non-extension
modules, i.e. actual data files. After a ":"
optionally a filename pattern can be given as well,
selecting only matching files. Examples: "--include-
package-data=package_name" (all files) "--include-
package-data=package_name=*.txt" (only certain type) "
--include-package-data=package_name=some_filename.dat
(concrete file) Default empty.
--include-data-files=DESC
Include data files by filenames in the distribution.
There are many allowed forms. With '--include-data-
files=/path/to/file/*.txt=folder_name/some.txt' it
will copy a single file and complain if it's multiple.
With '--include-data-
files=/path/to/files/*.txt=folder_name/' it will put
all matching files into that folder. For recursive
copy there is a form with 3 values that '--include-
data-files=/path/to/scan=folder_name=**/*.txt' that
will preserve directory structure. Default empty.
--include-data-dir=DIRECTORY
Include data files from complete directory in the
distribution. This is recursive. Check '--include-
data-files' with patterns if you want non-recursive
inclusion. An example would be '--include-data-
dir=/path/some_dir=data/some_dir' for plain copy, of
the whole directory. All files are copied, if you want
to exclude files you need to remove them beforehand,
or use '--noinclude-data-files' option to remove them.
Default empty.
--noinclude-data-files=PATTERN
Do not include data files matching the filename
pattern given. This is against the target filename,
not source paths. So to ignore a file pattern from
package data for "package_name" should be matched as
"package_name/*.txt". Or for the whole directory
simply use "package_name". Default empty.
--list-package-data=LIST_PACKAGE_DATA
Output the data files found for a given package name.
Default not done.
DLL files:
--noinclude-dlls=PATTERN
Do not include DLL files matching the filename pattern
given. This is against the target filename, not source
paths. So ignore a DLL "someDLL" contained in the
package "package_name" it should be matched as
"package_name/someDLL.*". Default empty.
--list-package-dlls=LIST_PACKAGE_DLLS
Output the DLLs found for a given package name.
Default not done.
Control the warnings to be given by Nuitka:
--warn-implicit-exceptions
Enable warnings for implicit exceptions detected at
compile time.
--warn-unusual-code
Enable warnings for unusual code detected at compile
time.
--assume-yes-for-downloads
Allow Nuitka to download external code if necessary,
e.g. dependency walker, ccache, and even gcc on
Windows. To disable, redirect input from nul device,
e.g. "" is used. For compatibility reasons, the
"__file__" value will always have ".py" suffix
independent of what it really is.
--module-name-choice=MODE
Select what value "__name__" and "__package__" are
going to be. With "runtime" (default for module mode),
the created module uses the parent package to deduce
the value of "__package__", to be fully compatible.
The value "original" (default for other modes) allows
for more static optimization to happen, but is
incompatible for modules that normally can be loaded
into any package.
Output choices:
--output-filename=FILENAME
Specify how the executable should be named. For
extension modules there is no choice, also not for
standalone mode and using it will be an error. This
may include path information that needs to exist
though. Defaults to '' on this platform.
.exe
--output-dir=DIRECTORY
Specify where intermediate and final output files
should be put. The DIRECTORY will be populated with
build folder, dist folder, binaries, etc. Defaults to
current directory.
--remove-output Removes the build directory after producing the module
or exe file. Defaults to off.
--no-pyi-file Do not create a ".pyi" file for extension modules
created by Nuitka. This is used to detect implicit
imports. Defaults to off.
Debug features:
--debug Executing all self checks possible to find errors in
Nuitka, do not use for production. Defaults to off.
--unstripped Keep debug info in the resulting object file for
better debugger interaction. Defaults to off.
--profile Enable vmprof based profiling of time spent. Not
working currently. Defaults to off.
--internal-graph Create graph of optimization process internals, do not
use for whole programs, but only for small test cases.
Defaults to off.
--trace-execution Traced execution output, output the line of code
before executing it. Defaults to off.
--recompile-c-only This is not incremental compilation, but for Nuitka
development only. Takes existing files and simply
compile them as C again. Allows compiling edited C
files for quick debugging changes to the generated
source, e.g. to see if code is passed by, values
output, etc, Defaults to off. Depends on compiling
Python source to determine which files it should look
at.
--xml=XML_FILENAME Write the internal program structure, result of
optimization in XML form to given filename.
--generate-c-only Generate only C source code, and do not compile it to
binary or module. This is for debugging and code
coverage analysis that doesn't waste CPU. Defaults to
off. Do not think you can use this directly.
--experimental=FLAG
Use features declared as 'experimental'. May have no
effect if no experimental features are present in the
code. Uses secret tags (check source) per experimented
feature.
--low-memory Attempt to use less memory, by forking less C
compilation jobs and using options that use less
memory. For use on embedded machines. Use this in case
of out of memory problems. Defaults to off.
--create-environment-from-report=CREATE_ENVIRONMENT_FROM_REPORT
Create a new virtualenv in that non-existing path from
the report file given with e.g. '--report=compilation-
report.xml'. Default not done.
Backend C compiler choice:
--clang Enforce the use of clang. On Windows this requires a
working Visual Studio version to piggy back on.
Defaults to off.
--mingw64 Enforce the use of MinGW64 on Windows. Defaults to off
unless MSYS2 with MinGW Python is used.
--msvc=MSVC_VERSION
Enforce the use of specific MSVC version on Windows.
Allowed values are e.g. "14.3" (MSVC 2022) and other
MSVC version numbers, specify "list" for a list of
installed compilers, or use "latest". Defaults to
latest MSVC being used if installed, otherwise MinGW64
is used.
--jobs=N Specify the allowed number of parallel C compiler
jobs. Defaults to the system CPU count.
--lto=choice Use link time optimizations (MSVC, gcc, clang).
Allowed values are "yes", "no", and "auto" (when it's
known to work). Defaults to "auto".
--static-libpython=choice
Use static link library of Python. Allowed values are
"yes", "no", and "auto" (when it's known to work).
Defaults to "auto".
Cache Control:
--disable-cache=DISABLED_CACHES
Disable selected caches, specify "all" for all cached.
Currently allowed values are:
"all","ccache","bytecode","dll-dependencies". can be
given multiple times or with comma separated values.
Default none.
--clean-cache=CLEAN_CACHES
Clean the given caches before executing, specify "all"
for all cached. Currently allowed values are:
"all","ccache","bytecode","dll-dependencies". can be
given multiple times or with comma separated values.
Default none.
--disable-bytecode-cache
Do not reuse dependency analysis results for modules,
esp. from standard library, that are included as
bytecode. Same as --disable-cache=bytecode.
--disable-ccache Do not attempt to use ccache (gcc, clang, etc.) or
clcache (MSVC, clangcl). Same as --disable-
cache=ccache.
--disable-dll-dependency-cache
Disable the dependency walker cache. Will result in
much longer times to create the distribution folder,
but might be used in case the cache is suspect to
cause errors. Same as --disable-cache=dll-
dependencies.
--force-dll-dependency-cache-update
For an update of the dependency walker cache. Will
result in much longer times to create the distribution
folder, but might be used in case the cache is suspect
to cause errors or known to need an update.
PGO compilation choices:
--pgo Enables C level profile guided optimization (PGO), by
executing a dedicated build first for a profiling run,
and then using the result to feedback into the C
compilation. Note: This is experimental and not
working with standalone modes of Nuitka yet. Defaults
to off.
--pgo-args=PGO_ARGS
Arguments to be passed in case of profile guided
optimization. These are passed to the special built
executable during the PGO profiling run. Default
empty.
--pgo-executable=PGO_EXECUTABLE
Command to execute when collecting profile
information. Use this only, if you need to launch it
through a script that prepares it to run. Default use
created program.
Tracing features:
--report=REPORT_FILENAME
Report module, data files, compilation, plugin, etc.
details in an XML output file. This is also super
useful for issue reporting. These reports can e.g. be
used to re-create the environment easily using it with
'--create-environment-from-report', but contain a lot
of information. Default is off.
--report-template=REPORT_DESC
Report via template. Provide template and output
filename "template.rst.j2:output.rst". For built-in
templates, check the User Manual for what these are.
Can be given multiple times. Default is empty.
--quiet Disable all information outputs, but show warnings.
Defaults to off.
--show-scons Run the C building backend Scons with verbose
information, showing the executed commands, detected
compilers. Defaults to off.
--no-progressbar Disable progress bars. Defaults to off.
--show-progress Obsolete: Provide progress information and statistics.
Disables normal progress bar. Defaults to off.
--show-memory Provide memory information and statistics. Defaults to
off.
--show-modules Provide information for included modules and DLLs
Obsolete: You should use '--report' file instead.
Defaults to off.
--show-modules-output=PATH
Where to output '--show-modules', should be a
filename. Default is standard output.
--verbose Output details of actions taken, esp. in
optimizations. Can become a lot. Defaults to off.
--verbose-output=PATH
Where to output from '--verbose', should be a
filename. Default is standard output.
General OS controls:
--disable-console When compiling for Windows or macOS, disable the
console window and create a GUI application. Defaults
to off.
--enable-console When compiling for Windows or macOS, enable the
console window and create a console application. This
disables hints from certain modules, e.g. "PySide"
that suggest to disable it. Defaults to true.
--force-stdout-spec=FORCE_STDOUT_SPEC
Force standard output of the program to go to this
location. Useful for programs with disabled console
and programs using the Windows Services Plugin of
Nuitka commercial. Defaults to not active, use e.g.
'%PROGRAM%.out.txt', i.e. file near your program.
--force-stderr-spec=FORCE_STDERR_SPEC
Force standard error of the program to go to this
location. Useful for programs with disabled console
and programs using the Windows Services Plugin of
Nuitka commercial. Defaults to not active, use e.g.
'%PROGRAM%.err.txt', i.e. file near your program.
Windows specific controls:
--windows-icon-from-ico=ICON_PATH
Add executable icon. Can be given multiple times for
different resolutions or files with multiple icons
inside. In the later case, you may also suffix with
# where n is an integer index starting from 1,
specifying a specific icon to be included, and all
others to be ignored.
--windows-icon-from-exe=ICON_EXE_PATH
Copy executable icons from this existing executable
(Windows only).
--onefile-windows-splash-screen-image=SPLASH_SCREEN_IMAGE
When compiling for Windows and onefile, show this
while loading the application. Defaults to off.
--windows-uac-admin
Request Windows User Control, to grant admin rights on
execution. (Windows only). Defaults to off.
--windows-uac-uiaccess
Request Windows User Control, to enforce running from
a few folders only, remote desktop access. (Windows
only). Defaults to off.
macOS specific controls:
--macos-target-arch=MACOS_TARGET_ARCH
What architectures is this to supposed to run on.
Default and limit is what the running Python allows
for. Default is "native" which is the architecture the
Python is run with.
--macos-create-app-bundle
When compiling for macOS, create a bundle rather than
a plain binary application. Currently experimental and
incomplete. Currently this is the only way to unlock
disabling of console.Defaults to off.
--macos-app-icon=ICON_PATH
Add icon for the application bundle to use. Can be
given only one time. Defaults to Python icon if
available.
--macos-signed-app-name=MACOS_SIGNED_APP_NAME
Name of the application to use for macOS signing.
Follow "com.YourCompany.AppName" naming results for
best results, as these have to be globally unique, and
will potentially grant protected API accesses.
--macos-app-name=MACOS_APP_NAME
Name of the product to use in macOS bundle
information. Defaults to base filename of the binary.
--macos-app-mode=MODE
Mode of application for the application bundle. When
launching a Window, and appearing in Docker is
desired, default value "gui" is a good fit. Without a
Window ever, the application is a "background"
application. For UI elements that get to display
later, "ui-element" is in-between. The application
will not appear in dock, but get full access to
desktop when it does open a Window later.
--macos-sign-identity=MACOS_APP_VERSION
When signing on macOS, by default an ad-hoc identify
will be used, but with this option your get to specify
another identity to use. The signing of code is now
mandatory on macOS and cannot be disabled. Default
"ad-hoc" if not given.
--macos-sign-notarization
When signing for notarization, using a proper TeamID
identity from Apple, use the required runtime signing
option, such that it can be accepted.
--macos-app-version=MACOS_APP_VERSION
Product version to use in macOS bundle information.
Defaults to "1.0" if not given.
--macos-app-protected-resource=RESOURCE_DESC
Request an entitlement for access to a macOS protected
resources, e.g.
"NSMicrophoneUsageDescription:Microphone access for
recording audio." requests access to the microphone
and provides an informative text for the user, why
that is needed. Before the colon, is an OS identifier
for an access right, then the informative text. Legal
values can be found on https://developer.apple.com/doc
umentation/bundleresources/information_property_list/p
rotected_resources and the option can be specified
multiple times. Default empty.
Linux specific controls:
--linux-icon=ICON_PATH
Add executable icon for onefile binary to use. Can be
given only one time. Defaults to Python icon if
available.
Binary Version Information:
--company-name=COMPANY_NAME
Name of the company to use in version information.
Defaults to unused.
--product-name=PRODUCT_NAME
Name of the product to use in version information.
Defaults to base filename of the binary.
--file-version=FILE_VERSION
File version to use in version information. Must be a
sequence of up to 4 numbers, e.g. 1.0 or 1.0.0.0, no
more digits are allowed, no strings are allowed.
Defaults to unused.
--product-version=PRODUCT_VERSION
Product version to use in version information. Same
rules as for file version. Defaults to unused.
--file-description=FILE_DESCRIPTION
Description of the file used in version information.
Windows only at this time. Defaults to binary
filename.
--copyright=COPYRIGHT_TEXT
Copyright used in version information. Windows only at
this time. Defaults to not present.
--trademarks=TRADEMARK_TEXT
Copyright used in version information. Windows only at
this time. Defaults to not present.
Plugin control:
--enable-plugin=PLUGIN_NAME
Enabled plugins. Must be plug-in names. Use '--plugin-
list' to query the full list and exit. Default empty.
--disable-plugin=PLUGIN_NAME
Disabled plugins. Must be plug-in names. Use '--
plugin-list' to query the full list and exit. Most
standard plugins are not a good idea to disable.
Default empty.
--plugin-no-detection
Plugins can detect if they might be used, and the you
can disable the warning via "--disable-plugin=plugin-
that-warned", or you can use this option to disable
the mechanism entirely, which also speeds up
compilation slightly of course as this detection code
is run in vain once you are certain of which plugins
to use. Defaults to off.
--plugin-list Show list of all available plugins and exit. Defaults
to off.
--user-plugin=PATH The file name of user plugin. Can be given multiple
times. Default empty.
--show-source-changes
Show source changes to original Python file content
before compilation. Mostly intended for developing
plugins. Default False.
Plugin options of 'anti-bloat':
--show-anti-bloat-changes
Annotate what changes are by the plugin done.
--noinclude-setuptools-mode=NOINCLUDE_SETUPTOOLS_MODE
What to do if a 'setuptools' or import is encountered.
This package can be big with dependencies, and should
definitely be avoided. Also handles 'setuptools_scm'.
--noinclude-pytest-mode=NOINCLUDE_PYTEST_MODE
What to do if a 'pytest' import is encountered. This
package can be big with dependencies, and should
definitely be avoided. Also handles 'nose' imports.
on.
--noinclude-custom-mode=CUSTOM_CHOICES
What to do if a specific import is encountered. Format
is module name, which can and should be a top level
package and then one choice, "error", "warning",
"nofollow", e.g. PyQt5:error.