gpt4 book ai didi

python - 为什么kivy无法导入kivy_clock?

转载 作者:行者123 更新时间:2023-12-05 00:04:52 24 4
gpt4 key购买 nike

https://kivy.org/doc/stable/api-kivy.app.html

import kivy

kivy.require('1.0.7')

from kivy.app import App

from kivy.uix.button import Button


class TestApp(App):

def build(self):
# return a Button() as a root widget
return Button(text='hello world')


if __name__ == '__main__':
TestApp().run()

根据上面的代码我有以下错误

[INFO   ] [Logger      ] Record log in C:\Users\USER\.kivy\logs\kivy_20-05-09_45.txt
[INFO ] [deps ] Successfully imported "kivy_deps.angle" 0.1.10
[INFO ] [Kivy ] v1.11.1
[INFO ] [Kivy ] Installed at "C:\Users\USER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\kivy\__init__.py"
[INFO ] [Python ] v3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 22:39:24) [MSC v.1916 32 bit (Intel)]
[INFO ] [Python ] Interpreter at "C:\Users\USER\AppData\Local\Programs\Python\Python38-32\python.exe"
[ERROR ] [Clock ] Unable to import kivy._clock. Have you perhaps forgotten to compile kivy? Kivy contains Cython code which needs to be compiled. A missing kivy._clock often indicates the Cython code has not been compiled. Please follow the installation instructions and make sure to compile Kivy
Traceback (most recent call last):
File "C:/Users/USER/PycharmProjects/Hello world/pop.py", line 4, in <module>
from kivy.app import App
File "C:\Users\USER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\kivy\app.py", line 319, in <module>
from kivy.base import runTouchApp, stopTouchApp
File "C:\Users\USER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\kivy\base.py", line 26, in <module>
from kivy.clock import Clock
File "C:\Users\USER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\kivy\clock.py", line 363, in <module>
from kivy._clock import CyClockBase, ClockEvent, FreeClockEvent, \
ModuleNotFoundError: No module named 'kivy._clock'

我认为 kivy_clock 和 Cython 有问题。

最佳答案

因为无论如何安装 Kivy,您都没有编译它或安装预编译版本。

您是否遵循了 kivy.org 的说明?

关于python - 为什么kivy无法导入kivy_clock?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61699003/

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