PyInstaller 编译的 Kivy 应用程序不起作用
Posted
技术标签:
【中文标题】PyInstaller 编译的 Kivy 应用程序不起作用【英文标题】:Doesn't work Kivy app compilated by PyInstaller 【发布时间】:2019-09-19 13:20:53 【问题描述】:myapp.py 是可行的。编译exe后,出现错误。 基维: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.
有什么问题,我需要做什么? 提前致谢。
【问题讨论】:
Kivy error, [CRITICAL] [Text ] unable to find any valuable text provider (python 3.6.1) (windows 10)的可能重复 确保遵循 kivy 文档kivy.org/doc/stable/installation/installation.html 【参考方案1】:python -m pip install opencv-contrib-python-headless
python -m pip install pyenchant
python -m pip install cython
python -m pip install Pillow
【讨论】:
欢迎来到 Stack Overflow!虽然这段代码 sn-p 可以解决问题,但它没有解释为什么或如何回答问题。请include an explanation for your code,因为这确实有助于提高您的帖子质量。请记住,您是在为将来的读者回答问题,而这些人可能不知道您提出代码建议的原因。以上是关于PyInstaller 编译的 Kivy 应用程序不起作用的主要内容,如果未能解决你的问题,请参考以下文章
Pyinstaller 难以通过 Kivy 构建 FileChooserListView
使用 pyinstaller 打包后 Kivy 应用程序崩溃
如何从我的 kivy 应用程序(Pyinstaller)获取 Windows 可执行文件?