Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I make PyInstaller optimize the compilation?

When I use PyInstaller, it builds my modules as .pyc files. But I'd prefer it to run the compilation with -OO to optmize and remove docstrings. Is this possible?

like image 483
xorsyst Avatar asked Oct 19 '22 12:10

xorsyst


1 Answers

Since pyinstaller is a Python script, it is sufficient to run it with optimisation activated: e.g.

PYTHONOPTIMIZE=2 pyinstaller script.py

so that during bundling .pyo files are created instead of .pyc

like image 128
Stefano M Avatar answered Oct 21 '22 05:10

Stefano M