Search code examples
python-3.xpyinstallernuitka

How to combine a exe and dependencies to one file


I have a exe and some dependencies make by Nuitka.

python -m nuitka --standalone --windows-dependency-tool=pefile --experimental=use_pefile_recurse --experimental=use_pefile_fullrecurse example.py

How to combine them to one single file like Pyinstaller did?


Solution

  • Since version 0.6.10 (Dec. 2020) or so, Nuitka has added --onefile option. Docs are a bit scattered/thin, but here are some examples (also search the page for "onefile"). But basically just to add the --onefile argument (--standalone is not required).

    You can also use the -o argument to name the final executable as something other than the name of the .py script being built (see --help). Not sure when that was added.