python - kivy 模块安装失败,如何解决?
问题描述
pip install cython
python -m virtualenv kivy_env
kivy_env\Scripts\activate
pip install kivy_deps.gstreamer==0.1.*
pip install kivy_deps.angle==0.1.*
pip install kivy
最后一个命令给出以下错误。
Microsoft Windows [Version 10.0.19041.630]
(c) 2020 Microsoft Corporation. All rights reserved.
(venv) C:\Users\UdayKiranReddy\PycharmProjects\pythonProject>pip install kivy
Collecting kivy
Using cached Kivy-1.11.1.tar.gz (23.6 MB)
ERROR: Command errored out with exit status 1:
command: 'c:\users\udaykiranreddy\pycharmprojects\pythonproject\venv\scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\UdayKi
ranReddy\\AppData\\Local\\Temp\\pip-install-bslm8np7\\kivy_ecf3b0a632eb42a8a10a708e4fb19474\\setup.py'"'"'; __file__='"'"'C:\\Users\\UdayKiranReddy\\AppData\\Local\\Tem
p\\pip-install-bslm8np7\\kivy_ecf3b0a632eb42a8a10a708e4fb19474\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"',
'"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\UdayKiranReddy\AppData\Local\Temp\pip-pip-egg-info-whukn1ir'
cwd: C:\Users\UdayKiranReddy\AppData\Local\Temp\pip-install-bslm8np7\kivy_ecf3b0a632eb42a8a10a708e4fb19474\
Complete output (83 lines):
fatal: not a git repository (or any of the parent directories): .git
WARNING: Skipping page https://github.com/kivy-garden/garden/archive/master.zip because the HEAD request got Content-Type: application/zip.The only supported Conten
t-Type is text/html
ERROR: Command errored out with exit status 1:
command: 'c:\users\udaykiranreddy\pycharmprojects\pythonproject\venv\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\U
dayKiranReddy\\AppData\\Local\\Temp\\pip-wheel-cghv2wc5\\cython_d75d970a73ce474cb11b9629b7e22955\\setup.py'"'"'; __file__='"'"'C:\\Users\\UdayKiranReddy\\AppData\\Local
\\Temp\\pip-wheel-cghv2wc5\\cython_d75d970a73ce474cb11b9629b7e22955\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"
'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\UdayKiranReddy\AppData\Local\Temp\pip-wheel-hqy4vafk'
cwd: C:\Users\UdayKiranReddy\AppData\Local\Temp\pip-wheel-cghv2wc5\cython_d75d970a73ce474cb11b9629b7e22955\
Complete output (7 lines):
Unable to find pgen, not compiling formal grammar.
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'bdist_wheel'
----------------------------------------
ERROR: Failed building wheel for cython
ERROR: Failed to build one or more wheels
WARNING: The wheel package is not available.
Traceback (most recent call last):
File "c:\users\udaykiranreddy\pycharmprojects\pythonproject\venv\lib\site-packages\setuptools\installer.py", line 126, in fetch_build_egg
subprocess.check_call(cmd)
File "C:\Users\UdayKiranReddy\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['c:\\users\\udaykiranreddy\\pycharmprojects\\pythonproject\\venv\\scripts\\python.exe', '-m', 'pip', '--disable-pip-versio
n-check', 'wheel', '--no-deps', '-w', 'C:\\Users\\UDAYKI~1\\AppData\\Local\\Temp\\tmpwosh7xph', '--quiet', '--find-links', 'https://github.com/kivy-garden/garden/archiv
e/master.zip', 'cython!=0.27,!=0.27.2,<=0.29.10,>=0.24']' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\UdayKiranReddy\AppData\Local\Temp\pip-install-bslm8np7\kivy_ecf3b0a632eb42a8a10a708e4fb19474\setup.py", line 1073, in <module>
setup(
File "c:\users\udaykiranreddy\pycharmprojects\pythonproject\venv\lib\site-packages\setuptools\__init__.py", line 152, in setup
_install_setup_requires(attrs)
File "c:\users\udaykiranreddy\pycharmprojects\pythonproject\venv\lib\site-packages\setuptools\__init__.py", line 147, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "c:\users\udaykiranreddy\pycharmprojects\pythonproject\venv\lib\site-packages\setuptools\dist.py", line 673, in fetch_build_eggs
resolved_dists = pkg_resources.working_set.resolve(
File "c:\users\udaykiranreddy\pycharmprojects\pythonproject\venv\lib\site-packages\pkg_resources\__init__.py", line 764, in resolve
dist = best[req.key] = env.best_match(
File "c:\users\udaykiranreddy\pycharmprojects\pythonproject\venv\lib\site-packages\pkg_resources\__init__.py", line 1049, in best_match
return self.obtain(req, installer)
File "c:\users\udaykiranreddy\pycharmprojects\pythonproject\venv\lib\site-packages\pkg_resources\__init__.py", line 1061, in obtain
return installer(requirement)
File "c:\users\udaykiranreddy\pycharmprojects\pythonproject\venv\lib\site-packages\setuptools\dist.py", line 732, in fetch_build_egg
return fetch_build_egg(self, req)
File "c:\users\udaykiranreddy\pycharmprojects\pythonproject\venv\lib\site-packages\setuptools\installer.py", line 128, in fetch_build_egg
raise DistutilsError(str(e)) from e
distutils.errors.DistutilsError: Command '['c:\\users\\udaykiranreddy\\pycharmprojects\\pythonproject\\venv\\scripts\\python.exe', '-m', 'pip', '--disable-pip-vers
ion-check', 'wheel', '--no-deps', '-w', 'C:\\Users\\UDAYKI~1\\AppData\\Local\\Temp\\tmpwosh7xph', '--quiet', '--find-links', 'https://github.com/kivy-garden/garden/arch
ive/master.zip', 'cython!=0.27,!=0.27.2,<=0.29.10,>=0.24']' returned non-zero exit status 1.
Using setuptools
User distribution detected, avoid portable command.
Using this graphics system: OpenGL
WARNING: A problem occurred while running pkg-config --libs --cflags gstreamer-1.0 (code 1)
b"'pkg-config' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n"
WARNING: A problem occurred while running pkg-config --libs --cflags gstreamer-1.0 (code 1)
b"'pkg-config' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n"
WARNING: A problem occurred while running pkg-config --libs --cflags sdl2 SDL2_ttf SDL2_image SDL2_mixer (code 1)
b"'pkg-config' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n"
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.
这是关于安装的,因此发布在 serverfault 中,但他们将我重定向到此处并在那里关闭了该问题。
我在多台机器上尝试过,但在那里也遇到了同样的问题。
即使我尝试为 python 创建一个虚拟环境,也有同样的问题。尝试使用较低版本的python3。即python 3.7 64位但同样的问题。
解决方案
我们需要安装构建工具作为先决条件。
然后,我们需要安装 cython(最新版本)。 0.29.21 为我工作。
pip install cython
然后使用安装kivy。
pip install kivy
推荐阅读
- javascript - 如何使用 VB.NET 从服务器端获取客户端值?
- wpf - 使用组合从 XAML 错误模板访问 INotifyDataErrorInfo 验证错误
- kubernetes - Kubernetes Pod 终止不会立即发生,必须等到宽限期到期
- xslt - XSLT/XPATH : 处理 XHTML 文件以将分隔的文本部分转换为新类
- python - 在 Python 中绘制方波
- typescript - 将元素添加到打字稿 Record<>
- python - 如何在matplotlib中将坐标轴刻度格式化为有效数字
- python - 抓取网站时出错 (http.client.BadStatusLine: )
- nginx - elasticbeanstalk 不会复制我的 nginx 配置
- python - 获得每组的第 20 到第 80 个百分位数 - Pyspark