zoukankan      html  css  js  c++  java
  • Kivy SDL2: Unable to load image

    2020-08-06 19:03:44,843 MainThread WARNING : Image: Unable to load image <C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivydataglsldefault.png>
    2020-08-06 19:03:44,848 MainThread 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 - Exception: SDL2: Unable to load image
      File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivycore\__init__.py", line 71, in core_select_lib
        cls = cls()
      File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivycorewindowwindow_sdl2.py", line 152, in __init__
        super(WindowSDL, self).__init__()
      File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivycorewindow\__init__.py", line 981, in __init__
        self.create_window()
      File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivycorewindowwindow_sdl2.py", line 312, in create_window
        super(WindowSDL, self).create_window()
      File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivycorewindow\__init__.py", line 1258, in create_window
        self.render_context = RenderContext()
      File "kivygraphicsinstructions.pyx", line 783, in kivy.graphics.instructions.RenderContext.__init__
      File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivycoreimage\__init__.py", line 561, in __init__
        self.filename = arg
      File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivycoreimage\__init__.py", line 756, in _set_filename
        mipmap=self._mipmap, nocache=self._nocache)
      File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivycoreimage\__init__.py", line 460, in load
        im = loader(filename, **kwargs)
      File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivycoreimage\__init__.py", line 223, in __init__
        self._data = self.load(filename)
      File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivycoreimageimg_sdl2.py", line 47, in load
        raise Exception('SDL2: Unable to load image')
    

    这个文件C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packageskivydataglsldefault.png 是存在的

    处理办法:在导入kivy模块前添加一下代码

    import os 
    os.environ['KIVY_IMAGE'] = 'pil,sdl2'
    

    参考:https://github.com/kivy/kivy/issues/4115

  • 相关阅读:
    maven 创建web项目出错
    poj1699--Best Sequence(dfs+剪枝)
    HDU-1042-N!(Java大法好 &amp;&amp; HDU大数水题)
    “XXX.Index”不扩展类“System.Web.UI.Page”,因此此处不同意的问题
    scala模式匹配
    scala匿名函数
    scala特质
    group by的使用
    liux之我用过的zip解压命令
    liunx之zip格式的解压命令
  • 原文地址:https://www.cnblogs.com/onsunsl/p/Kivy_SDL2_Unable_to_load_image.html
Copyright © 2011-2022 走看看