1

I have a somewhat complex Python file that is literally 14K, when saved as a .py file. I used the following technique to convert it into an executable:

pyinstaller.exe --onefile MyCode.py

Now, the executable is 309MB. I deployed it to a VM, ran it, and it works fine. However, I'm questioning the bloat; does this make any sense?

jonrsharpe
  • 107,083
  • 22
  • 201
  • 376
ASH
  • 18,040
  • 13
  • 61
  • 153
  • 8
    When you package it into an `.exe`, it also has to include the standard library and any other imports you have, along with `python.exe` to actually run python. – TheStrangeQuark Jan 18 '19 at 15:39
  • You could try setting up a `venv` and only having the necessary installs, but otherwise it's difficult to reduce that file size. – TheStrangeQuark Jan 18 '19 at 15:41
  • Yeah, that makes sense. I still think it is quite excessive, and very inefficient, for the file to grow over 20,000x in size. I guess, it is what it is. Thanks for the insight everyone! – ASH Jan 18 '19 at 16:11

0 Answers0