吃不到Kivy鳕鱼

2024-04-25 00:45:40 发布

您现在位置:Python中文网/ 问答频道 /正文

我试着用Kivy运行一个简单的helloworld程序。我的Mac电脑上安装了正确的版本(1.8),但我收到一条错误消息,窗口无法打开。在

 from kivy.app import App
 from kivy.uix.button import Button

class TestApp(App):
 def build(self):
    return Button(text='Hello World')

TestApp().run()

$ python hello_world.py 
[INFO              ] Kivy v1.8.0
[INFO              ] [Logger      ] Record log in /Users/d/.kivy/logs/kivy_15-01-13_4.txt
[INFO              ] [Factory     ] 157 symbols loaded
[DEBUG             ] [Cache       ] register <kv.lang> with limit=None, timeout=Nones
[DEBUG             ] [Cache       ] register <kv.image> with limit=None, timeout=60s
[DEBUG             ] [Cache       ] register <kv.atlas> with limit=None, timeout=Nones
[INFO              ] [Image       ] Providers: img_imageio, img_tex, img_dds, img_pil,     img_gif (img_pygame ignored)
[DEBUG             ] [Cache       ] register <kv.texture> with limit=1000, timeout=60s
[DEBUG             ] [Cache       ] register <kv.shader> with limit=1000, timeout=3600s
[DEBUG             ] [Text        ] Ignored <pygame> (import error)
[DEBUG             ] [Text        ] Ignored <sdlttf> (import error)
[INFO              ] [Text        ] Provider: pil(['text_pygame', 'text_sdlttf'] ignored)
[DEBUG             ] [App         ] Loading kv <./test.kv>
[DEBUG             ] [App         ] kv <./test.kv> not found
[DEBUG             ] [Window      ] Ignored <egl_rpi> (import error)
[DEBUG             ] [Window      ] Ignored <pygame> (import error)
[WARNING           ] [WinPygame   ] SDL wrapper failed to import!
[DEBUG             ] [Window      ] Ignored <sdl> (import error)
[DEBUG             ] [Window      ] Ignored <x11> (import error)
[CRITICAL          ] [Window      ] Unable to find any valuable Window provider at all!
[CRITICAL          ] [App         ] Unable to get a Window, abort.
Exception SystemExit: 1 in 'kivy.properties.dpi2px' ignored
[CRITICAL          ] [App         ] Unable to get a Window, abort.

Tags: debugimportinforegisterappcacheimgwith
1条回答
网友
1楼 · 发布于 2024-04-25 00:45:40

根据线路

[DEBUG             ] [Text        ] Ignored <pygame> (import error)
[DEBUG             ] [Text        ] Ignored <sdlttf> (import error)

你对Kivy的依赖可能安装不当或过时,正如Mark Ransom所说。尝试更新Kivy的依赖项。^Github Kivy论坛上的{a1}已经详细讨论了这个问题,尽管它是在Ubuntu上,而不是macosx上,并且有几个用户报告说,更新Kivy依赖关系可以解决这个问题。在

相关问题 更多 >