不起作用由PyInstaller编译的Kivy应用程序

问题描述 投票:2回答:1

myapp.py是可行的。编译exe后,发生错误。 Kivy:v1.10.1 Python:v3.6.5

只需myapp.py运行良好,无需编译。它只包含一个按钮。

myapp.spec:

# -*- mode: python -*-
from kivy.deps import sdl2, glew
block_cipher = None


a = Analysis(['myapp.py'],
             pathex=['C:\\Users\\Username\\Desktop\\test'],
             binaries=[],
             datas=[],
             hiddenimports=[],
             hookspath=[],
             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,
          a.scripts,
          [],
          exclude_binaries=True,
          name='myapp',
          debug=False,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          console=True )
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               *[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
               strip=False,
               upx=True,
               name='myapp')

安慰:

[CRITICAL] Text: Unable to find any valuable Text provider.
sdl2 - ImportError: DLL load failed: Не найдена указанная процедура.
  File "D:\Python\lib\site-packages\kivy\core\__init__.py", line 59, in core_select_lib
    fromlist=[modulename], level=0)
  File "D:\Python\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "D:\Python\lib\site-packages\kivy\core\text\text_sdl2.py", line 12, in <module>
    from kivy.core.text._text_sdl2 import (_SurfaceContainer, _get_extents,

pil - ModuleNotFoundError: No module named 'PIL'
  File "D:\Python\lib\site-packages\kivy\core\__init__.py", line 59, in core_select_lib
    fromlist=[modulename], level=0)
  File "D:\Python\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "D:\Python\lib\site-packages\kivy\core\text\text_pil.py", line 7, in <module>
    from PIL import Image, ImageFont, ImageDraw

[CRITICAL] App: Unable to get a Text provider, abort.

有什么问题,我需要做什么?提前致谢。

python kivy pyinstaller
1个回答
0
投票
python -m pip install opencv-contrib-python-headless
python -m pip install pyenchant
python -m pip install cython
python -m pip install Pillow
© www.soinside.com 2019 - 2024. All rights reserved.