为什么kivy无法导入kivy_clock?

时间:2023-03-21
本文介绍了为什么kivy无法导入kivy_clock?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

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:UsersUSER.kivylogskivy_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:UsersUSERAppDataLocalProgramsPythonPython38-32libsite-packageskivy\__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:UsersUSERAppDataLocalProgramsPythonPython38-32python.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:UsersUSERAppDataLocalProgramsPythonPython38-32libsite-packageskivyapp.py", line 319, in <module>
     from kivy.base import runTouchApp, stopTouchApp
   File "C:UsersUSERAppDataLocalProgramsPythonPython38-32libsite-packageskivyase.py", line 26, in <module>
     from kivy.clock import Clock
   File "C:UsersUSERAppDataLocalProgramsPythonPython38-32libsite-packageskivyclock.py", line 363, in <module>
     from kivy._clock import CyClockBase, ClockEvent, FreeClockEvent, 
 ModuleNotFoundError: No module named 'kivy._clock'

我认为 kivy_clock 和 Cython 有问题.

I think there is a problem with the kivy_clock and Cython.

推荐答案

因为你安装了 Kivy,你并没有编译它,也没有安装预编译版本.

Because however you installed Kivy, you didn't compile it or install a precompiled version.

您是否按照 kivy.org 的说明进行操作?

Did you follow the instructions as kivy.org?

这篇关于为什么kivy无法导入kivy_clock?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:Kivy 中的 HTTPS 请求 下一篇:如何捕获 kivy-client 崩溃日志并将其发送到我的服务器?

相关文章