找不到指定的模块

找不到指定的模块

本文介绍了sdl2-ImportError:DLL加载失败:找不到指定的模块,并且[CRITICAL] [App]无法获取窗口,中止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  • Python:3.6.4
  • 操作系统:Windows 10
  • 基维:1.10.0
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

说明

我正在尝试从安装Kivy中运行示例代码.以下是我收到的错误.任何帮助将是巨大的.我曾尝试查看有关类似问题的先前查询,但到目前为止,有关这些问题的建议均未奏效.

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:\Users\DoddJ\.kivy\logs\kivy_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:\Users\dev.DoddJ\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\core\__init__.py", line 59, in core_select_lib
fromlist=[modulename], level=0)
    File "C:\Users\dev.DoddJ\AppData\Local\Programs\Python\Python36-32\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.
  Exception ignored in: 'kivy.properties.dpi2px'
  Traceback (most recent call last):
    File "C:\Users\dev.DoddJ\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\utils.py", line 496, in __get__
      retval = self.func(inst)
    File "C:\Users\dev.DoddJ\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\metrics.py", line 174, in dpi
      EventLoop.ensure_window()
    File "C:\Users\dev.DoddJ\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\base.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()

推荐答案

我遇到了同样的问题.我首先通过Kivy及其依赖项解决了它.

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

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

现在重新安装除gstreamer之外的所有内容.

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

它解决了错误.归功于 Ben R的答案.

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

这篇关于sdl2-ImportError:DLL加载失败:找不到指定的模块,并且[CRITICAL] [App]无法获取窗口,中止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 03:15