我最近在我的Ubuntu 16.04计算机上安装了kivy
,并尝试使用docs中给出的第一个应用程序创建。
但是当我尝试运行main.py
时,我收到以下错误:
[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
:
python3 -m pip install pygame --user
但它没有删除错误。请任何人帮帮我!!
答案 0 :(得分:1)
其他人遇到了同样的问题并通过运行
修复了它sudo apt-get install libsdl2-2.0-0 libsdl2-image-2.0-0 libsdl2-mixer-2.0-0 libsdl2-ttf-2.0-0
答案 1 :(得分:0)
因此要在ubuntu 18,python3中安装:
sudo add-apt-repository ppa:kivy-team/kivy
sudo apt-get install python3-kivy
sudo apt-get install libsdl2-2.0-0 libsdl2-image-2.0-0 libsdl2-mixer-2.0-0 libsdl2-ttf-2.0-0