當我嘗試在我的kali linux操作系統中使用python 3.5運行任何kivy程序時。然後我得到下面的錯誤。x11 - ImportError:沒有名爲'kivy.core.window.window_x11'的模塊
程序: -
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.relativelayout import RelativeLayout
Builder.load_string('''
<hey>:
RelativeLayout:
Button:
text:"Hey"
''')
class hey(RelativeLayout):
pass
class helloApp(App):
def build(self):
return hey()
if __name__=="__main__":
helloApp().run()
錯誤: -
[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 59, 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 67, in core_select_lib
cls = cls()
File "/usr/lib/python3/dist-packages/kivy/core/window/window_sdl2.py", line 138, in __init__
super(WindowSDL, self).__init__()
File "/usr/lib/python3/dist-packages/kivy/core/window/__init__.py", line 722, in __init__
self.create_window()
File "/usr/lib/python3/dist-packages/kivy/core/window/window_sdl2.py", line 237, in create_window
self.fullscreen, resizable, state)
File "kivy/core/window/_window_sdl2.pyx", line 94, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window (kivy/core/window/_window_sdl2.c:2204)
x11 - ImportError: No module named 'kivy.core.window.window_x11'
File "/usr/lib/python3/dist-packages/kivy/core/__init__.py", line 59, in core_select_lib
fromlist=[modulename], level=0)
[CRITICAL] [App ] Unable to get a Window, abort.
它曾經是做工精細當我安裝在前面的卡利Linux操作系統kivy但由於一些原因,我安裝了再次卡利和kivy再次,但這次我不能使它工作。
解決它只是運行一個命令「PIP安裝的git +的https://github.com/kivy/[email protected]」在終端和它的工作對我來說 –