简体   繁体   English

Kivy 使用 Pyinstaller 编译后 MacO 上的应用程序崩溃

[英]Kivy app crash on MacOs after compiling with Pyinstaller

Here is my problem: I have a Kivy app.这是我的问题:我有一个 Kivy 应用程序。 It runs perfectly with python but when I compile it with Pyinstaller to.dmg the app crash at launch... I don't know why.它与 python 完美运行,但是当我使用 Pyinstaller to.dmg 编译它时,应用程序在启动时崩溃......我不知道为什么。 (Compiling with pyinstaller on windows works). (在 windows 上使用 pyinstaller 进行编译)。

Here's my.spec:这是我的规范:

# -*- mode: python ; coding: utf-8 -*-


block_cipher = None


a = Analysis(
    ['main.py'],
    pathex=[],
    binaries=[],
    datas=[
        ('myKivy.kv','.'),
        ('CertifitechModules/','CertifitechModules'),
        ('ressources/','ressources')
        ],
    hiddenimports=[],
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    win_no_prefer_redirects=False,
    win_private_assemblies=False,
    cipher=block_cipher,
    noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

exe = EXE(
    pyz,
    Tree('/Users/simon/Downloads/Certifitech/'),
    a.scripts,
    [],
    exclude_binaries=True,
    name='Certifitech',
    debug=True,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    console=True,
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
)
coll = COLLECT(
    exe,
    Tree('/Users/simon/Downloads/Certifitech/'),
    a.binaries,
    a.zipfiles,
    a.datas,
    strip=False,
    upx=True,
    upx_exclude=[],
    name='Certifitech',
)
app = BUNDLE(
    coll,
    name='Certifitech.app',
    icon="icon.ico",
    bundle_identifier=None,
)

To compile it I use the kivy and home-brew tutorial: pyinstaller -y --clean main.spec要编译它,我使用 kivy 和自制教程: pyinstaller -y --clean main.spec

And for.dmg: hdiutil create./main.dmg -srcfolder main.app -ov对于.dmg: hdiutil create./main.dmg -srcfolder main.app -ov

Any idea?任何的想法? Maybe at least a way to show a console with errors can help me because now, I have nothing at all !也许至少一种显示错误控制台的方法可以帮助我,因为现在,我什么都没有了!

Thanks !谢谢 !

I assume you to have external libraries used in the code, if that is true, you need to check the dist folder for all the folders that correspond to the libraries imported by you我假设您在代码中使用了外部库,如果是这样,您需要检查 dist 文件夹中与您导入的库相对应的所有文件夹

for example, If you have face_recognition library imported in your app you need to check for two folders in your dist directory例如,如果您的应用程序中导入了 face_recognition 库,则需要检查 dist 目录中的两个文件夹

  1. face recognition 2)face_recognition models人脸识别2)face_recognition模型

Pyinstaller sometimes dosent include certain libraries required by our code Pyinstaller 有时会包含我们代码所需的某些库

You add them manually and the app will work Butter smooth.您手动添加它们,应用程序将运行 Butter 流畅。

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

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