Why Is My Stackless Executable So Much Smaller
I wrote a few games for a competition in Stackless Python and needed to create an executable. Accidentally though, I used CPython 2.6 instead of using Stackless Python 2.5 to build the executable. I rebuilt correctly, and found that the final size of the dist was down from slightly over 30 MB down to around 8. Out of curiosity, why exactly was this? As a guess, I would hazard that it is because I have 开发者_如何学Cinstalled libraries like Twisted and Qt4 in CPython, but not in Stackless, and Py2exe packages in everything, whether or not they are used (possibly because you can always call code dynamically), but if anyone actually knows, I would be interested in learning why.
py2exe does look through to your dependencies and only includes the ones it thinks you're using. You can manually specify an exclude list if it's including extra modules.
Check out this py2exe script (replace "setup.py" with the name of your own main py file). This setup script skips the bundling step, so you can look through to see what is taking up the most space.
精彩评论