gpt4 book ai didi

python - 无法在 kivy 中打开窗口

转载 作者:行者123 更新时间:2023-12-02 20:13:28 30 4
gpt4 key购买 nike

我开始在我的游戏中使用 kivy,因此在遵循一些在线教程时,python shell 返回这些错误。

[INFO] [Logger] Record log in C:\Users\...\.kivy\logs\kivy_18-10-23_8.txt
[INFO] [Kivy] v1.10.1
[INFO] [Python] v3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)]
[INFO] [Factory] 194 symbols loaded
[INFO] [Image] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO] [Window] Provider: sdl2
[CRITICAL] [Window] Unable to find any valuable Window provider.
sdl2 - ImportError: DLL load failed: The specified module could not be found.
File "C:\Users\...\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kivy\core\__init__.py", line 67, in core_select_lib
cls = cls()
File "C:\Users\...\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kivy\core\window\window_sdl2.py", line 140, in __init__
super(WindowSDL, self).__init__()
File "C:\Users\...\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kivy\core\window\__init__.py", line 968, in __init__
self.create_window()
File "C:\Users\...\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kivy\core\window\window_sdl2.py", line 272, in create_window
self.fullscreen, resizable, state)
File "kivy\core\window\_window_sdl2.pyx", line 125, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window
File "kivy\graphics\cgl.pyx", line 52, in kivy.graphics.cgl.cgl_get_backend_name
File "kivy\graphics\cgl.pyx", line 60, in kivy.graphics.cgl.cgl_get_backend_name
File "C:\Users\...\AppData\Local\Programs\Python\Python37-32\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 670, in _load_unlocked
File "<frozen importlib._bootstrap>", line 583, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 1043, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
[CRITICAL] [App] Unable to get a Window, abort.

我已经安装了 docutils、pygments、pypiwin32、kivy.deps.sdl2、kivy.deps.glew 和 Cython。我正在使用 kivy 1.10.1 和 python 3.7.0我遵循的代码是这样的:

from kivy.app import App
from kivy.uix.widget import Widget


class PongGame(Widget):
pass


class PongApp(App):
def build(self):
return PongGame()


if __name__ == '__main__':
PongApp().run()

我的模块有错误还是代码有问题?

最佳答案

查看 Kivy's install Docs我能够从全新安装中重复您的问题,在该安装中我安装了 kivy,而没有先执行依赖项。

我通过按顺序运行这些来修复它:

python -m pip install --upgrade pip wheel setuptools

python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew

python -m pip install kivy.deps.gstreamer

python -m pip install kivy

当您运行 Python 3 时,您还需要:

python -m pip install kivy.deps.angle

注意:如果您运行的环境包含 python2 和 python3 - 请确保将 pip 替换为 pip3

关于python - 无法在 kivy 中打开窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52950076/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com