V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
MartinAgerAdams
V2EX  ›  Python

Python customtkinter 应用打包 Mac APP 爬坑求教

  •  
  •   MartinAgerAdams · 64 天前 · 1037 次点击
    这是一个创建于 64 天前的主题,其中的信息可能已经有所发展或是发生改变。

    前置背景

    • 我把 Python customtkinter 应用打包 Mac APP ,点击之后图标跳动几次,就任何反应没有了。卡在这里了两天了。
    • 使用 nuitka 打包
    • xxxx.app/Content/MacOs 下面的可执行文件可以正常打开应用

    需求

    • 点击打包好的 xxx.app 可以正常打开应用
    9 条回复    2024-03-05 03:02:31 +08:00
    Laysan
        1
    Laysan  
       64 天前
    那就用 nuitka 打包
    MartinAgerAdams
        2
    MartinAgerAdams  
    OP
       64 天前
    @Laysan 就是已经打包了。遇到问题才来问的嘛
    darcyC
        3
    darcyC  
       64 天前
    非 nuitka 用户,但你提到的这个问题,你可以考虑 2 个点:
    1. 最小的 HelloWorld 窗体应用是否正常运行?
    2. 代码内的资源“相对路径”引用的问题,换句话说,就是当前的工作路径。
    makerbi
        4
    makerbi  
       63 天前   ❤️ 1
    手动从终端启动应用,看看终端里有什么报错提示
    receyuki
        5
    receyuki  
       63 天前   ❤️ 1
    非得用 nuitka 吗?还是说能打上就行?
    https://github.com/receyuki/stable-diffusion-prompt-reader
    我自己的项目 mac 版是用 py2app 打的.能用,坑少,但是性能肯定不如 nuitka,而且作者适配维护也慢
    pyinstaller 也能打但是启动会非常慢.每次都要全解压一遍.所以我只用来打 exe
    cx_freeze 作者维护更积极,感觉是个更好的选择
    darcyC
        6
    darcyC  
       61 天前   ❤️ 1
    @receyuki 这里只是一提,实际上直接使用 -w 参数的 pyinstaller 在 macOS 平台只会打成 Bundle ,没有解压带来的性能差异。在 Windows 平台单文件的确会多出额外的非常卡顿的解压过程。
    MartinAgerAdams
        7
    MartinAgerAdams  
    OP
       58 天前
    @makerbi 没错。正常启动。
    @receyuki 能打包成功就行。先能用,再说性能问题。
    @darcyC

    感谢此帖所有 V 友 的热心解答。
    receyuki
        8
    receyuki  
       54 天前
    @MartinAgerAdams #7 那建议试一下 py2app.会简单很多.如果闪退的话直接把里面的可执行文件丢到 terminal 跑跑看.然后把 error 解决完基本就正常了
    receyuki
        9
    receyuki  
       54 天前
    @darcyC #6 照理来说 mac 上应该不用解压但是打开确实很慢.我这边和 py2app 至少有三五倍时间的差异
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1226 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 23:40 · PVG 07:40 · LAX 16:40 · JFK 19:40
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.