如何解决在Python 3.8中安装Kivy时出现的错误?

18

我已经从Kivy安装了Python中的所有必要代码,但我需要的最后一个是python -m pip install kivy,但我遇到了以下错误:

ERROR: Dependency for context.pyx not resolved: config.pxi
ERROR: Dependency for compiler.pyx not resolved: config.pxi
ERROR: Dependency for context_instructions.pyx not resolved: config.pxi
ERROR: Dependency for fbo.pyx not resolved: config.pxi
ERROR: Dependency for gl_instructions.pyx not resolved: config.pxi
ERROR: Dependency for instructions.pyx not resolved: config.pxi
ERROR: Dependency for opengl.pyx not resolved: config.pxi
ERROR: Dependency for opengl_utils.pyx not resolved: config.pxi
ERROR: Dependency for shader.pyx not resolved: config.pxi
ERROR: Dependency for stencil_instructions.pyx not resolved: config.pxi
ERROR: Dependency for scissor_instructions.pyx not resolved: config.pxi
ERROR: Dependency for texture.pyx not resolved: config.pxi
ERROR: Dependency for vbo.pyx not resolved: config.pxi
ERROR: Dependency for vertex.pyx not resolved: config.pxi
ERROR: Dependency for vertex_instructions.pyx not resolved: config.pxi
ERROR: Dependency for cgl.pyx not resolved: config.pxi
ERROR: Dependency for cgl_mock.pyx not resolved: config.pxi
ERROR: Dependency for cgl_gl.pyx not resolved: config.pxi
ERROR: Dependency for cgl_glew.pyx not resolved: config.pxi
ERROR: Dependency for cgl_sdl2.pyx not resolved: config.pxi
ERROR: Dependency for svg.pyx not resolved: config.pxi
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我使用的是Windows 10操作系统,请帮忙!


1
你正在使用哪个Python版本? - inclement
2
请尝试使用3.7版本。 - inclement
它能够工作,在3.7上安装了,但现在我又遇到了另一个错误。虽然它已经安装了,但是它告诉我它不存在。我遇到了这个错误:'kivy'不被认为是内部或外部命令、可操作的程序或批处理文件。你知道该怎么做吗? - Atis
听起来你正在尝试将kivy作为命令行命令运行,但这不是你可以做的事情,Kivy是一个Python模块,你必须在Python中导入它。如果这不能解释你的问题,请提供更多关于你正在尝试做什么的信息。 - inclement
你需要使用 "python3 -m pip .." 而不是 "python -m pip ..."。 - Pablo Díaz
显示剩余14条评论
5个回答

25

这对我有用:

matham在15天前发表评论 我们不太可能发布适用于3.8到pypi的1.11.1版本。但是,您可以使用以下命令安装kivy主分支:

pip install kivy[base] kivy_examples --pre --extra-index-url https://kivy.org/downloads/simple/

这解决了我在 Fedora 27 年后的问题,但我很想知道为什么。有人能分享一些知识吗? - Spacemoose

7

尝试使用 pip install kivy==2.0.0rc2pip install kivy==2.0.0rc1

该命令:pip install kivy==2.0.0rc2

可以在 Windows 10 ProPython 3.8.3 上运行

我用以下代码进行了测试:

from kivy.app import App
from kivy.uix.button import Button
 
class TestApp(App):
    def build(self):
        return Button(text= " Hello Kivy World ")

TestApp().run()

它还可以与rc4、arch linux和python 3.8.5一起使用。 - n0nvme

2

这在macOS Catalina 10.15.6上使用python 3.8.0+可行。

pip install kivy==2.0.0rc2

0
如果您正在使用conda环境:
 conda install -c conda-forge kivy 

适用于Python 3.8


-2

我是Windows 10,使用3.8.2版本。

看起来pip install kivy==2.0.0rc2成功了。至少已经安装好了。

现在是时候测试一下是否可以使用3.8.2版本进行开发了。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接