简体   繁体   English

PyInstaller / py2exe发行版太大

[英]PyInstaller / py2exe distribution is too large

I'm trying to create a distribution folder 'freeze' (currently for windows, later for other OS's) for my python program. 我正在尝试为我的python程序创建一个分发文件夹“ freeze”(当前用于Windows,稍后用于其他OS)。 at first I used py2exe and later PyInstaller. 最初我使用py2exe,后来使用PyInstaller。 I only use a few functions from Scipy: 我只使用了Scipy的一些功能:

from scipy.misc import imread
from scipy.linalg import norm
from scipy import sum, average

My final distribution folder looks like this: 我的最终分发文件夹如下所示: 分发文件夹,注意* .pyd大小

Overall the folder size is almost 200MB and my program isn't all that. 总体而言,文件夹大小几乎为200MB,而我的程序还不够。 I need a way to either replace 'numpy' and 'scipy' with other "leaner" packages, or preferably tweak with the "freezer" program to make it include as little as possible. 我需要一种方法来用其他“更精简”的软件包替换“ numpy”和“ scipy”,或者最好是对“ freezer”程序进行调整,以使其包含的内容尽可能少。

ps single file distribution is roughly 50MB, which is also too large for me. ps单个文件分发大约为50MB,这对我来说也太大了。

Thanks 谢谢

Sometimes pyinstaller includes "optional" imports that are not always necessary. 有时pyinstaller包含并非总是必需的“可选”导入。 You can try to exclude some of the large Numpy libs, eg via --exclude-module from the command line. 您可以尝试从命令行中排除一些大型的Numpy库,例如通过--exclude-module You will then have to test thoroughly that your program still works. 然后,您将必须彻底测试您的程序仍然可以运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM