PyInstaller onefile vs onedir: which is better for Windows users?
A practical comparison of onefile and onedir builds—startup time, reliability, antivirus false positives, and distribution tips.
The short answer
Use onedir when you want faster startup, easier debugging, and fewer surprises. Use onefile when you need a single distributable EXE and you can accept slower startup (because the app needs to unpack itself at launch).
How they differ in real projects
- Startup time: onefile usually starts slower due to unpacking; onedir typically starts faster.
- Reliability: onedir can be more transparent—files are visible, paths are easier to diagnose.
- Distribution: onefile is convenient to share; onedir is a folder (more files, but often more robust).
Recommendation matrix
Choose onefile if…
You need a single EXE for sharing, demos, or lightweight distribution.
Choose onedir if…
You care about startup performance, transparency, and quick debugging.
If you’re unsure…
Start with onedir, then switch to onefile when the build is stable.
Practical tip
Keep your build settings consistent across versions. When you change packaging mode, re-test startup behavior, resource paths, and antivirus reputation. If you want a repeatable workflow, use the product page to download the GUI and keep your settings organized.
Next steps
If you want a smoother packaging workflow, download PyInstaller GUI and keep your build settings consistent.