有没有办法减少 pyinstaller 生成的 .exe 文件大小?

发布于 2025-01-17 03:15:00 字数 405 浏览 2 评论 0原文

所以我做了一个超级简单的程序,只有 1 次导入(它是 pysimplegui ),当我编译它时,大小是 9 mb? py 文件只有 1 kb...

有没有办法让它至少小于 8 mb?

这是我的代码:

import PySimpleGUI as sg

layout = [[sg.Text('Test app')]]

window = sg.Window('test app', layout, finalize=True)

while True:
    event, values = window.read()

    if event == sg.WIN_CLOSED:
        break

window.close()

So I made a super simple program with 1 import (it being pysimplegui) and when i compile it the size is 9 mb? The py file is just 1 kb...

Is there a way to make it be less than 8 mb atleast?

Here is my code:

import PySimpleGUI as sg

layout = [[sg.Text('Test app')]]

window = sg.Window('test app', layout, finalize=True)

while True:
    event, values = window.read()

    if event == sg.WIN_CLOSED:
        break

window.close()

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

感性不性感 2025-01-24 03:15:00

因为 pyinstaller 将当前 python 核心和附加模块的副本(递归搜索文件和模块中的导入)包含到您的构建中。例如,Python core .dll 的大小约为 3.5Mb。

Cause pyinstaller include a copy of your current python core and additional modules (searching recursively for imports in your files and modules) to your build. Python core .dll has size about 3.5Mb, for example.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文