Python KIVY::ModuleNotFoundError:no module named kivy.clock

tkclm6bt  于 2023-11-15  发布在  Python
关注(0)|答案(1)|浏览(133)

我刚刚安装了kivy,我一直在尝试使用它一段时间了,但我一直得到这个错误:

[INFO   ] [Logger      ] Record log in C:\Users\goal\.kivy\logs\kivy_20-04-28_9.txt
[INFO   ] [deps        ] Successfully imported "kivy_deps.gstreamer_dev" 0.2.0
[INFO   ] [deps        ] Successfully imported "kivy_deps.glew" 0.2.0
[INFO   ] [deps        ] Successfully imported "kivy_deps.glew_dev" 0.2.0
[INFO   ] [Kivy        ] v1.11.1
[INFO   ] [Kivy        ] Installed at "C:\Users\goal\AppData\Roaming\Python\Python37\site- 
packages\kivy\__init__.py"
[INFO   ] [Python      ] v3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 00:42:30) [MSC v.1916 64 bit 
(AMD64)]
[INFO   ] [Python      ] Interpreter at "C:\Program Files\Python37\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\goal\3D Objects\My Projects\PythonApplication2\PythonApplication2.py", line 3, in 
<module>
 from kivy.app import App
File "C:\Users\goal\AppData\Roaming\Python\Python37\site-packages\kivy\app.py", line 319, in <module>
 from kivy.base import runTouchApp, stopTouchApp
File "C:\Users\goal\AppData\Roaming\Python\Python37\site-packages\kivy\base.py", line 26, in <module>
 from kivy.clock import Clock
File "C:\Users\goal\AppData\Roaming\Python\Python37\site-packages\kivy\clock.py", line 363, in 
<module>
 from kivy._clock import CyClockBase, ClockEvent, FreeClockEvent, \
ModuleNotFoundError: No module named 'kivy._clock'

字符串

这是我从他们的网站上复制的代码,我尝试了几种不同的方法,但仍然得到相同的结果:

import kivy
from kivy.app import App
from kivy.uix.label import Label

class myapp(App):

    def build(self):

        return Label(text="Hello World")

myapp().run()

4jb9z9bj

4jb9z9bj1#

在您的环境中尝试这些:

pip uninstall kivy

字符串
然后再进行以下操作:

pip install--no-cache-dir kivy


希望它能解决这个问题。

相关问题