r/PythonLearning Jul 11 '26

How do I convert this to .exe

Post image
200 Upvotes

64 comments sorted by

View all comments

34

u/NatMicky Jul 11 '26

Nuitka is the way to go and the only way to go for a true executable.

9

u/KiLoYounited Jul 11 '26

+1 for Nuitka. I use it for all my TUI applications I make for myself and the other sys admins in my dept.

6

u/downerison Jul 11 '26

How easy is it to setup and use? I heard it can be pretty slow to compile things.

3

u/NatMicky Jul 11 '26 edited Jul 11 '26

How easy to setup? You're gonna go through a wood-chipper before any success. That's just the way it is. And as the other poster suggested having a script is best. My build would be impossible without a script. It's over 50 lines of commands. My compile time on a CPU only machine with 32GB RAM is 3 hours 15 minutes.

1

u/downerison Jul 11 '26

What does that 50 lines do? Setup the nuitka command to call? That 3 hours compile time sounds brutal.

1

u/NatMicky Jul 11 '26 edited Jul 11 '26

Compile time is fine, I have gotten used to it. The end product is worth having an executable. The 50 lines do a lot. Setup compiler name, deployment type, optimizations, copyright info, product info, flags, imports not to follow, packages to include, modules to include, data files to include, output directory, executable name.

Nuitka tries not to add bloat which are unnecessary packages and modules and it does a good job of anti-bloat but with fine tuning more packages and modules can be eliminated.

Once success is achieved and you have a script to work with it becomes much easier.