因此,我正在研究不同的kivy教程,一切都很好。然后今天,当我运行以前可以运行的脚本时开始出现错误:
kivy.factory.FactoryException: Unknown class <WindowManager>
我试着摆弄,不知道出了什么问题。然后,我尝试运行一个简单的Hello World脚本:
import kivy
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.screenmanager import ScreenManager, Screen
class MyApp(App):
def build(self):
return Label(text='Hello world')
if __name__ == '__main__':
MyApp().run()
我仍然得到例外。这是它返回的内容:
File "C:\Users\Manu\Dropbox\Python\other\Test.py", line 14, in <module>
MyApp().run()
File "D:\Progs\Pyton37\lib\site-packages\kivy\app.py", line 828, in run
self.load_kv(filename=self.kv_file)
File "D:\Progs\Pyton37\lib\site-packages\kivy\app.py", line 599, in load_kv
root = Builder.load_file(rfilename)
File "D:\Progs\Pyton37\lib\site-packages\kivy\lang\builder.py", line 301, in load_file
return self.load_string(data, **kwargs)
File "D:\Progs\Pyton37\lib\site-packages\kivy\lang\builder.py", line 399, in load_string
widget = Factory.get(parser.root.name)(__no_builder=True)
File "D:\Progs\Pyton37\lib\site-packages\kivy\factory.py", line 131, in __getattr__
raise FactoryException('Unknown class <%s>' % name)
kivy.factory.FactoryException: Unknown class <WindowManager>
这很奇怪,因为今天早上一切正常,并且我没有安装其他软件包或模块。
我尝试了pip卸载kivy和pip install kivy进行全新安装。尝试重新启动。没运气。该错误同时存在于PyScripter和PyCharm上。
我不知道这里发生了什么... 谢谢,