Проблема Киви — Не удалось получить окно, прервать

#python #python-3.x #visual-studio #pip #kivy

Вопрос:

Проблема:

Я пытаюсь запустить kivy в первый раз для своего проекта python 3.9, но получаю следующую ошибку:

Python : 3.9

ОС: Windows 10

Способ установки:

 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.deps.angle
python -m pip install kivy
 

Ошибка:

 Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

[INFO ] [Logger ] Record log in C:UsersUser.kivylogskivy_21-09-18_23.txt
[INFO ] [deps ] Successfully imported "kivy_deps.gstreamer" 0.3.2
[INFO ] [deps ] Successfully imported "kivy_deps.angle" 0.3.0
[INFO ] [deps ] Successfully imported "kivy_deps.glew" 0.3.0
[INFO ] [deps ] Successfully imported "kivy_deps.sdl2" 0.3.1
[INFO ] [Kivy ] v2.0.0
[INFO ] [Kivy ] Installed at "C:UsersUserAppDataLocalPackagesPythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0LocalCachelocal-packagesPython39site-packageskivy_init_.py"
[INFO ] [Python ] v3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64 bit (AMD64)]
[INFO ] [Python ] Interpreter at "C:UsersUserAppDataLocalMicrosoftWindowsAppsPythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0python.exe"
[INFO ] [Factory ] 186 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds (img_sdl2, img_pil, img_ffpyplayer ignored)
[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 - ImportError: DLL load failed while importing window_sdl2: The specified module could not be found.
File "C:UsersUserAppDataLocalPackagesPythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0LocalCachelocal-packagesPython39site-packageskivycore_init.py", line 58, in core_select_lib
mod = import(name='{2}.{0}.{1}'.format(
File "C:UsersUserAppDataLocalPackagesPythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0LocalCachelocal-packagesPython39site-packageskivycorewindowwindow_sdl2.py", line 27, in
from kivy.core.window._window_sdl2 import _WindowSDL2Storage

[CRITICAL] [App ] Unable to get a Window, abort.
 

Код:

 from kivy.app import App

class TheLabApp(App):
   pass

TheLabApp().run()
 

Ответ №1:

Хорошо, я все исправил:

Я не знаю, как это работало, но я просто переустановил python 3.9 и kivy 2.0.0, а затем это сработало

Код для удаления kivy:

 python -m pip unisntall kivy
python -m pip uninstall kivy.deps.angle
python -m pip uninstall kivy.deps.sdl2
python -m pip uninstall kivy.deps.glew
python -m pip uninstall kivy.deps.gstreamer
 

Код для его переустановки:

 pip install kivy
pip install kivy.deps.angle
pip install kivy.deps.sdl2
pip install kivy.deps.glew
pip install kivy.deps.gstreamer