如何修复Kivy sdl2-ImportError:DLL加载失败:

时间:2019-05-29 20:24:43

标签: python-3.x kivy

嗨,我有正确的问题嗨,我有正确的安装kivy.deps.sdl2和kivy.deps.glew的问题。 我使用Windows 7 64位,Python 3.7.0 当我尝试使用代码测试kivy时:

from kivy.app import App
from kivy.uix.button import Button

class TestApp(App):
    def build(self):
        return Button(text='Hello World')

TestApp().run()

然后我得到了错误:

  [INFO   ] [Logger      ] Record log in C:\Users\rob\.kivy\logs\kivy_19- 
  05-29_63.txt
  [INFO   ] [Kivy        ] v1.10.1
  [INFO   ] [Python      ] v3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 
  04:59:51) [MSC v.1914 64 bit (AMD64)]
  [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: Nie można odnaleźć określonego 
  modułu.
  File "C:\Users\rob\AppData\Local\Programs\Python\Python37\lib\site- 
  packages\kivy\core\__init__.py", line 59, in core_select_lib
  fromlist=[modulename], level=0)
  File "C:\Users\rob\AppData\Local\Programs\Python\Python37\lib\site- 
  packages\kivy\core\window\window_sdl2.py", line 26, in <module>
  from kivy.core.window._window_sdl2 import _WindowSDL2Storage

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

我尝试了很多stackoverflow建议,但是没有任何效果,我可以补充一点,就是我也在PyCharm中尝试了模块。 当我以这种方式安装依赖项时,我感到很惊讶: python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew 他发现:

    C:\Users\rob> python -m pip install docutils pygments pypiwin32 
    kivy.deps.sdl2 kivy.deps.glew
    Requirement already satisfied: docutils in 
    c:\users\rob\appdata\local\programs\python\python37\lib\site-packages 
   (0.14)
   Requirement already satisfied: pygments in 
   c:\users\rob\appdata\local\programs\python\python37\lib\site-packages 
   (2.4.2)
   Requirement already satisfied: pypiwin32 in 
   c:\users\rob\appdata\local\programs\
   python\python37\lib\site-packages (223) Collecting kivy.deps.sdl2
   Using cached 
   https://files.pythonhosted.org/packages/06/4e/fa407f76ead2660da51
   b73ed53336742919d046e45c2b6c295a672a78c11/kivy_deps.sdl2-0.1.22-cp37- 
   cp37m-win_amd64.whl
   Collecting kivy.deps.glew Using cached 
   https://files.pythonhosted.org/packages/9c/e9/9ff000646f0041187b2
   60ae7e1392615b30f601373ab13080d49b264489d/kivy_deps.glew-0.1.12-cp37- 
   cp37m-win_amd64.whl
   Requirement already satisfied: pywin32>=223 in 
   c:\users\rob\appdata\local\programs\python\python37\lib\site-packages 
   (from pypiwin32) (224)
   Installing collected packages: kivy.deps.sdl2, kivy.deps.glew
   Successfully installed kivy.deps.glew kivy.deps.sdl2

也就是说,已经安装了其他依赖项,并且kivy.deps.sdl2 kivy.deps.glew总是可以成功安装,就像未安装一样。

0 个答案:

没有答案