Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
470 views
in Technique[技术] by (71.8m points)

python - sdl2 - ImportError: DLL load failed: The specified module could not be found and [CRITICAL] [App] Unable to get a Window, abort

  • Python: 3.6.4
  • OS: Windows 10
  • Kivy: 1.10.0

Kivy Installation Method

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
python -m pip install kivy_examples
python -m pip install Pillow
python -m pip install cython
python -m pip install PyEnchant

Description

Hi, I am trying to run the example code from the install Kivy. The following is the error I receive back. Any help would be great. I have tried looking at previous enquiries about similar problems, but nothing suggested on them has worked so far.

[INFO   ] [Logger      ] Record log in C:UsersDoddJ.kivylogskivy_18-03-26_52.txt
[INFO   ] [Kivy        ] v1.10.0
[INFO   ] [Python      ] v3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)]
[INFO   ] [Factory     ] 194 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_pil, img_gif (img_sdl2, img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: pil(['text_sdl2'] ignored)
[CRITICAL] [Window      ] Unable to find any valuable Window provider.
sdl2 - ImportError: DLL load failed: The specified module could not be found.
    File "C:Usersdev.DoddJAppDataLocalProgramsPythonPython36-32libsite-packageskivycore\__init__.py", line 59, in core_select_lib
fromlist=[modulename], level=0)
    File "C:Usersdev.DoddJAppDataLocalProgramsPythonPython36-32libsite-packageskivycorewindowwindow_sdl2.py", line 26, in <module>
from kivy.core.window._window_sdl2 import _WindowSDL2Storage

[CRITICAL] [App         ] Unable to get a Window, abort.
  Exception ignored in: 'kivy.properties.dpi2px'
  Traceback (most recent call last):
    File "C:Usersdev.DoddJAppDataLocalProgramsPythonPython36-32libsite-packageskivyutils.py", line 496, in __get__
      retval = self.func(inst)
    File "C:Usersdev.DoddJAppDataLocalProgramsPythonPython36-32libsite-packageskivymetrics.py", line 174, in dpi
      EventLoop.ensure_window()
    File "C:Usersdev.DoddJAppDataLocalProgramsPythonPython36-32libsite-packageskivyase.py", line 127, in ensure_window
      sys.exit(1)
SystemExit: 1
[CRITICAL] [App         ] Unable to get a Window, abort.

Code and Logs

Code that I am trying to run:

import kivy
kivy.require('1.10.0') # replace with your current kivy version !

from kivy.app import App
from kivy.uix.label import Label


class MyApp(App):

    def build(self):
        return Label(text='Hello world')


if __name__ == '__main__':
    MyApp().run()
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I had the same problem. I solved this by removing Kivy and its dependencies first.

python -m pip uninstall kivy

python -m pip uninstall kivy.deps.sdl2

python -m pip uninstall kivy.deps.glew

python -m pip uninstall kivy.deps.gstreamer

python -m pip uninstall image

Now reinstalling everything except gstreamer.

python -m pip install --upgrade pip wheel setuptools

python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew --extra-index-url https://kivy.org/downloads/packages/simple/

python -m pip install kivy

It solved the error. Credits to Ben R's Answer.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...