虽然我已经在cmd中安装了pip并导入了kivy,但我仍然得到一个错误,代码没有执行

2024-05-02 11:57:35 发布

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

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

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

TestApp().run()

回溯:

Traceback (most recent call last):
  File "c:\Users\HYPER\Desktop\training.py\from kivy.app import App.py", line 1, in <module>
    from kivy.app import App
  File "c:\Users\HYPER\Desktop\training.py\kivy.py", line 2, in <module>
    kivy.require('1.9.0')`enter code here`
AttributeError: module 'kivy' has no attribute 'require'

[Done] exited with code=1 in 4.102 seconds