Kivy on RaspberryPi(Raspbian) - 无法加载任何有价值的窗口提供程序

时间:2015-06-08 21:01:22

标签: raspberry-pi kivy python-3.4

在我的RaspberryPi上我使用的是Python v3.4.3。

最近,我(有点成功)通过以下shell命令设法安装了Kivy v1.9.1-dev:

sudo echo "deb http://vontaene.de/raspbian-updates/ . main" > /etc/apt/sources.list.d/gstreamer.list
sudo apt-get install pkg-config libgl1-mesa-dev libgles2-mesa-dev python-pygame python-setuptools libgstreamer1.0-dev git-core gstreamer1.0-plugins-{bad,base,good,ugly} gstreamer1.0-{omx,alsa} python-dev
sudo pip3.4 install cython
...
cd ~
git clone https://github.com/kivy/kivy
cd kivy
python3.4 setup.py build
sudo python3.4 setup.py install

安装花了相当长的时间,但最后,我觉得它进展顺利。

我将Pi更改为桌面模式(startx),打开一个shell,当我尝试启动示例" shader"时,我得到以下输出:

pi@RaspberryPi-02 ~/tools/language__python/FRM__kivy/examples/shader $ python3.4 plasma.py
[INFO   ] [Logger      ] Record log in /home/pi/.kivy/logs/kivy_15-06-08_4.txt
[INFO   ] [Kivy        ] v1.9.1-dev
[INFO   ] [Python      ] v3.4.3 (default, Mar  6 2015, 11:48:01)
[GCC 4.6.3]
[INFO   ] [Factory     ] 175 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_gif (img_pygame, img_pil, img_ffpyplayer ignored)
[INFO   ] [Window      ] Provider: egl_rpi
[INFO   ] [GL          ] OpenGL version <b'OpenGL ES 2.0'>
[INFO   ] [GL          ] OpenGL vendor <b'Broadcom'>
[INFO   ] [GL          ] OpenGL renderer <b'VideoCore IV HW'>
[INFO   ] [GL          ] OpenGL parsed version: 2, 0
[INFO   ] [GL          ] Shading version <b'OpenGL ES GLSL ES 1.00'>
[INFO   ] [GL          ] Texture max size <2048>
[INFO   ] [GL          ] Texture max units <8>
[INFO   ] [Shader      ] fragment shader: <b'Compiled'>
[INFO   ] [Shader      ] vertex shader: <b'Compiled'>
[CRITICAL] [Window      ] Unable to find any valuable Window provider at all!
egl_rpi - Exception: Unknown <png> type, no loader found.
  File "/usr/local/lib/python3.4/site-packages/kivy/core/__init__.py", line 65, in core_select_lib
    cls = cls()
  File "/usr/local/lib/python3.4/site-packages/kivy/core/window/__init__.py", line 625, in __init__
    self.create_window()
  File "/usr/local/lib/python3.4/site-packages/kivy/core/window/window_egl_rpi.py", line 26, in create_window
    super(WindowEglRpi, self).create_window()
  File "/usr/local/lib/python3.4/site-packages/kivy/core/window/__init__.py", line 783, in create_window
    self.render_context = RenderContext()
  File "kivy/graphics/instructions.pyx", line 756, in kivy.graphics.instructions.RenderContext.__init__ (kivy/graphics/instructions.c:10394)
  File "/usr/local/lib/python3.4/site-packages/kivy/core/image/__init__.py", line 511, in __init__
    self.filename = arg
  File "/usr/local/lib/python3.4/site-packages/kivy/core/image/__init__.py", line 699, in _set_filename
    mipmap=self._mipmap, nocache=self._nocache)
  File "/usr/local/lib/python3.4/site-packages/kivy/core/image/__init__.py", line 432, in load
    raise Exception('Unknown <%s> type, no loader found.' % ext)

pygame - ImportError: No module named 'pygame'
  File "/usr/local/lib/python3.4/site-packages/kivy/core/__init__.py", line 57, in core_select_lib
    fromlist=[modulename], level=0)
  File "/usr/local/lib/python3.4/site-packages/kivy/core/window/window_pygame.py", line 8, in <module>
    import pygame

x11 - ImportError: No module named 'kivy.core.window.window_x11'
  File "/usr/local/lib/python3.4/site-packages/kivy/core/__init__.py", line 57, in core_select_lib
    fromlist=[modulename], level=0)

 Traceback (most recent call last):
   File "plasma.py", line 92, in <module>
     PlasmaApp().run()
   File "/usr/local/lib/python3.4/site-packages/kivy/app.py", line 798, in run
     root = self.build()
   File "plasma.py", line 89, in build
     return ShaderWidget(fs=plasma_shader)
   File "plasma.py", line 62, in __init__
     self.canvas = RenderContext()
   File "kivy/graphics/instructions.pyx", line 756, in kivy.graphics.instructions.RenderContext.__init__ (kivy/graphics/instructions.c:10394)
   File "/usr/local/lib/python3.4/site-packages/kivy/core/image/__init__.py", line 511, in __init__
     self.filename = arg
   File "/usr/local/lib/python3.4/site-packages/kivy/core/image/__init__.py", line 699, in _set_filename
     mipmap=self._mipmap, nocache=self._nocache)
   File "/usr/local/lib/python3.4/site-packages/kivy/core/image/__init__.py", line 432, in load
     raise Exception('Unknown <%s> type, no loader found.' % ext)
 Exception: Unknown <png> type, no loader found.

有人看到我做错了什么,或者有人帮我找到让Kivy在我的Pi上运行的方法吗?

感谢。 nnako

1 个答案:

答案 0 :(得分:2)

Kivy需要一个库来加载png文件。

[INFO ] [Image ] Providers: img_tex, img_dds, img_gif (img_pygame, img_pil, img_ffpyplayer ignored)告诉你它可以加载什么(tex,dds,gif)以及被忽略的内容。

在python中,加载,保存和操作图像的“官方”库是PIL。 您需要安装PIL或更新的PIL:pillow

然后重启你的例子,它应该没问题。