繁体   English   中英

Pyinstaller.exe [CRITICAL] [Window] error sdl2 - RuntimeError: b'Could not initialize OpenGL / GLES library'

[英]Pyinstaller .exe [CRITICAL] [Window] error sdl2 - RuntimeError: b'Could not initialize OpenGL / GLES library'

C:\Users\thoma\PycharmProjects\FacesGUI\myexe\dist\main>main.exe
[INFO   ] [Logger      ] Record log in C:\Users\thoma\.kivy\logs\kivy_20-07-30_0.txt
[INFO   ] [deps        ] Successfully imported "kivy_deps.angle" 0.2.0
[INFO   ] [deps        ] Successfully imported "kivy_deps.glew" 0.2.0
[INFO   ] [deps        ] Successfully imported "kivy_deps.sdl2" 0.2.0
[INFO   ] [Kivy        ] v1.11.1
[INFO   ] [Kivy        ] Installed at "C:\Users\thoma\PycharmProjects\FacesGUI\myexe\dist\main\kivy\__init__.pyc"
[INFO   ] [Python      ] v3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)]
[INFO   ] [Python      ] Interpreter at "C:\Users\thoma\PycharmProjects\FacesGUI\myexe\dist\main\main.exe"
[INFO   ] [Factory     ] 184 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [Window      ] Provider: sdl2
[INFO   ] [Window      ] Activate GLES2/ANGLE context
[CRITICAL] [Window      ] Unable to find any valuable Window provider. Please enable debug logging (e.g. add -d if running from
the command line, or change the log level in the config) and re-run your app to identify potential causes
sdl2 - RuntimeError: b'Could not initialize OpenGL / GLES library'
  File "lib\site-packages\kivy\core\__init__.py", line 71, in core_select_lib
  File "lib\site-packages\kivy\core\window\window_sdl2.py", line 152, in __init__
  File "lib\site-packages\kivy\core\window\__init__.py", line 981, in __init__
  File "lib\site-packages\kivy\core\window\window_sdl2.py", line 290, in create_window
  File "kivy\core\window\_window_sdl2.pyx", line 224, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window
  File "kivy\core\window\_window_sdl2.pyx", line 74, in kivy.core.window._window_sdl2._WindowSDL2Storage.die

 Traceback (most recent call last):
   File "main.py", line 538, in <module>
   File "lib\site-packages\kivy\lang\builder.py", line 288, in load_file
 FileNotFoundError: [Errno 2] No such file or directory: 'main.kv'
[10100] Failed to execute script main

我非常接近(希望)执行我使用 pyinstaller 构建的.exe。 我相信这个问题与 sdl2 或 associated.dll(s) 有关。 根据本指南,我需要在 .spec 文件中指向 sdl2.dll

“前面的示例使用了例如 *[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins + gstreamer.dep_bins)],以使 PyInstaller 添加这些依赖项使用的所有 dll。如果 kivy 没有使用轮子安装方法这些命令将不起作用,例如 kivy_deps.sdl2 将无法导入。相反,必须找到这些 dll 的位置并以与示例类似的方式手动将它们传递给 Tree class。

我的规范

# -*- mode: python -*-

block_cipher = None

face_models = [
('.\\face_recognition_models\\models\\dlib_face_recognition_resnet_model_v1.dat', './face_recognition_models/models'),
('.\\face_recognition_models\\models\\mmod_human_face_detector.dat', './face_recognition_models/models'),
('.\\face_recognition_models\\models\\shape_predictor_5_face_landmarks.dat', './face_recognition_models/models'),
('.\\face_recognition_models\\models\\shape_predictor_68_face_landmarks.dat', './face_recognition_models/models'),
]

a = Analysis(['<main.py>'],
             pathex=['path to working directory'],
             binaries=face_models,
             datas=[],
             hiddenimports=['scipy._lib.messagestream', 'scipy', 'scipy.signal', 'scipy.signal.bsplines', 'scipy.special', 'scipy.special._ufuncs_cxx',
                            'scipy.linalg.cython_blas',
                            'scipy.linalg.cython_lapack',
                            'scipy.integrate',
                            'scipy.integrate.quadrature',
                            'scipy.integrate.odepack',
                            'scipy.integrate._odepack',
                            'scipy.integrate.quadpack',
                            'scipy.integrate._quadpack',
                            'scipy.integrate._ode',
                            'scipy.integrate.vode',
                            'scipy.integrate._dop', 'scipy._lib', 'scipy._build_utils','scipy.__config__',
                            'scipy.integrate.lsoda', 'scipy.cluster', 'scipy.constants','scipy.fftpack','scipy.interpolate','scipy.io','scipy.linalg','scipy.misc','scipy.ndimage','scipy.odr','scipy.optimize','scipy.setup','scipy.sparse','scipy.spatial','scipy.special','scipy.stats','scipy.version'],

             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher)

a.datas += Tree('./scipy-extra-dll', prefix=None)

pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          name='Faces',
          debug=False,
          strip=False,
          upx=True,
          runtime_tmpdir=None,
          console=True )

这个规范文件是从这里复制的,而且我不确定它的大部分内容。 只是试图让 .exe 启动并运行,以便我可以演示应用程序。

我将以下内容添加到 .spec 文件中:

from kivy_deps import glew, sdl2
Tree(<'path to main.py'>),
*[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],

这为我解决了 sdl2 问题。 我还在使用早期的英特尔高清显卡,它遇到了一些问题:OpenGL 和识别版本 2.0+stackoverflow 上 sdl2 问题的一些解决方案讨论了更改 KIVY BACKEND 的环境变量而不是 angle_sdl2 - 我也做了这种变化。

暂无
暂无

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

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