本文介绍了Kivy:[CRITICAL] [App]无法获取窗口,中止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在Ubuntu 16.04计算机上安装了kivy,并尝试使用文档.但是,当我尝试运行main.py时,出现以下错误:

I recently installed kivy in my Ubuntu 16.04 machine, and tried to create first application with it as given in the docs.But as soon as I tried running main.py, I got the following error:

[INFO   ] [Logger      ] Record log in /home/yathartha/.kivy/logs/kivy_17-08-03_7.txt
[INFO   ] [Kivy        ] v1.9.0
[INFO   ] [Python      ] v3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609]
[INFO   ] [Factory     ] 173 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_gif, img_sdl2, img_pil (img_ffpyplayer ignored)
[INFO   ] [OSC         ] using <multiprocessing> for socket
[INFO   ] [Window      ] Provider: sdl2(['window_egl_rpi'] ignored)
[CRITICAL] [Window      ] Unable to find any valuable Window provider at all!
egl_rpi - ImportError: cannot import name 'bcm'
  File "/usr/lib/python3/dist-packages/kivy/core/__init__.py", line 57, in core_select_lib
    fromlist=[modulename], level=0)
  File "/usr/lib/python3/dist-packages/kivy/core/window/window_egl_rpi.py", line 12, in <module>
    from kivy.lib.vidcore_lite import bcm, egl

sdl2 - TypeError: expected bytes, str found
  File "/usr/lib/python3/dist-packages/kivy/core/__init__.py", line 65, in core_select_lib
    cls = cls()
  File "/usr/lib/python3/dist-packages/kivy/core/window/window_sdl2.py", line 121, in __init__
    super(WindowSDL, self).__init__()
  File "/usr/lib/python3/dist-packages/kivy/core/window/__init__.py", line 616, in __init__
    self.create_window()
  File "/usr/lib/python3/dist-packages/kivy/core/window/window_sdl2.py", line 171, in create_window
    self.fullscreen, resizable, state)
  File "kivy/core/window/_window_sdl2.pyx", line 60, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window (kivy/core/window/_window_sdl2.c:1447)

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

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

我无法理解正在发生的事情.我什至尝试使用以下命令安装pygame:

I am unable to understand what is happening. I even tried installing pygame using following command:

python3 -m pip install pygame --user

,但它没有消除错误.请任何人能帮助我!

but it did not remove the error. Please can anyone help me out!!

推荐答案

其他人也遇到了同样的问题,并通过运行来解决了该问题

Somebody else had the same problem and fixed it by running

sudo apt-get install libsdl2-2.0-0 libsdl2-image-2.0-0 libsdl2-mixer-2.0-0 libsdl2-ttf-2.0-0

请参见 https://github.com/kivy/kivy/issues/3002

这篇关于Kivy:[CRITICAL] [App]无法获取窗口,中止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 03:15