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

  • 相关阅读:
    css3动画
    jquery和js进行添加样式
    网站基本了解
    新闻内容显示样式去除
    网页中常用的js特效
    手机和电脑同时兼容的网站
    使用repeter绑定数据的最高效率的方法
    常识(其他)
    OI暑假集训游记
    动态规划归纳(基础篇)
  • 原文地址:https://www.cnblogs.com/onsunsl/p/Kivy_SDL2_Unable_to_load_image.html
Copyright © 2011-2022 走看看