gpt4 book ai didi

python - x11 - 导入错误 : No module named 'kivy.core.window.window_x11'

转载 作者:太空狗 更新时间:2023-10-30 00:01:27 28 4
gpt4 key购买 nike

当我尝试在我的 kali linux 操作系统中使用 python 3.5 运行任何 kivy 程序时。然后我得到以下错误。

程序:-

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.

当我在以前的 kali linux 操作系统中安装 kivy 时,它曾经工作正常,但由于某些原因,我再次安装了 kali 并再次安装了 kivy,但这次我无法使其工作。

最佳答案

在我的例子中,它是一个过时的 kivy 版本。我看到你也在运行 python3。删除 kivy 后我做了以下解决了我的问题:

 sudo add-apt-repository ppa:kivy-team/kivy
sudo apt-get update
sudo apt-get install python3-kivy

关于python - x11 - 导入错误 : No module named 'kivy.core.window.window_x11' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45529794/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com