I know that python is interpreter language and that it means it converts script to machine code when you run it, but can someone clarify to me why can't it be pre converted to machine code (compiled).
I'm asking this because I have been making these simple programs with GUI using tkinter and I am using pyInstaller to create executable file. The problem is that sometimes I get this simple program (only a few lines of code) as big as 10s of MBs.
As I understand, PyInstaller packs all libraries and interpreter with script in exe which results in these sizes, but is there a way I can get this to somewhat rational size? Because I know same programs made in C++ much smaller (less than MB).
I don't know any of C or C++ so that isn't an option as I don't have time to learn it. Size really isn't that big to be much of a problem, but still, it's nice to have smaller file.
Check if the virtual environment that you are using does not have site-packages that you don't need. Usually it's these packages that are large. Create a new venv and only install the libraries you need and try.
Compiling python to a small exe file