无法使用pip在Windows中安装kivy模块 [英] Failed to install the module kivy in windows with pip

查看:151
本文介绍了无法使用pip在Windows中安装kivy模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用python 3.8.5的法语版AMD 64位Windows 10计算机

首先,我尝试在官方网站( https ://kivy.org/doc/stable/installation/installation-windows.html )

First I try to install kivy with the help of the official website (https://kivy.org/doc/stable/installation/installation-windows.html)

,但是在«kivy的构建轮(setup.py)»

complet错误的长度为531行,所以我只显示更重要的部分

ERROR: Command errored out with exit status 3221225477:
command: 'c:\users\%myusername%\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\%myusername%\\AppData\\Local\\Temp\\pip-install-payt_kgr\\kivy\\setup.py'"'"'; __file__='"'"'C:\\Users\\%myusername%\\AppData\\Local\\Temp\\pip-install-payt_kgr\\kivy\\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\%myusername%\AppData\Local\Temp\pip-wheel-a9go4zcz'
       cwd: C:\Users\%myusername%\AppData\Local\Temp\pip-install-payt_kgr\kivy\
WARNING: A problem occurred while running pkg-config --libs --cflags gstreamer-1.0 (code 1)
b"'pkg-config' n'est pas reconnu en tant que commande interne\r\nou externe, un programme ex\x82cutable ou un fichier de commandes.\r\n"
WARNING: A problem occurred while running pkg-config --libs --cflags gstreamer-1.0 (code 1)

b"'pkg-config' n'est pas reconnu en tant que commande interne\r\nou externe, un programme ex\x82cutable ou un fichier de commandes.\r\n"

WARNING: A problem occurred while running pkg-config --libs --cflags sdl2 SDL2_ttf SDL2_image SDL2_mixer (code 1)

b"'pkg-config' n'est pas reconnu en tant que commande interne\r\nou externe, un programme ex\x82cutable ou un fichier de commandes.\r\n"
 ERROR: Dependency for context.pyx not resolved: config.pxi
 (...)
 fatal: not a git repository (or any of the parent directories): .git
ERROR: Command errored out with exit status 3221225477: 'c:\users\%myusername%\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\%myusername%\\AppData\\Local\\Temp\\pip-install-payt_kgr\\kivy\\setup.py'"'"'; __file__='"'"'C:\\Users\\%myusername%\\AppData\\Local\\Temp\\pip-install-payt_kgr\\kivy\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\%myusername%\AppData\Local\Temp\pip-record-8x9xz8go\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\%myusername%\appdata\local\programs\python\python38\Include\kivy' Check the logs for full command output.

在尝试使用github源安装kivy之后,位于( https://github.com/kivy/kivy )并运行 «python setup.py安装»

After I tried to install kivy with the github source at (https://github.com/kivy/kivy) and run «python setup.py install»

失败

kivy\include\gl_redirect.h(37): fatal error C1083: Impossible d'ouvrir le fichier include : 'GL/glew.h' : No such file or directory
error: command 'D:\\programme\\visual code\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

所以我将目录kivy(在github的源中)移到了我的lib目录(«C:\ Users \%myusername%\ AppData \ Local \ Programs \ Python \ Python38 \ Lib»),并且我可以import kivy ,在导入中显示这些日志

So I moved the directory kivy (in the source of github) to my lib directory («C:\Users\%myusername%\AppData\Local\Programs\Python\Python38\Lib») and I could import kivy that show those logs in the import

[INFO   ] [Logger      ] Record log in C:\Users\%myusername%\.kivy\logs\kivy_20-07-24_19.txt
[INFO   ] [deps        ] Successfully imported "kivy_deps.gstreamer" 0.1.18
[INFO   ] [deps        ] Successfully imported "kivy_deps.angle" 0.1.10
[INFO   ] [deps        ] Successfully imported "kivy_deps.glew" 0.1.12
[INFO   ] [deps        ] Successfully imported "kivy_deps.sdl2" 0.1.23
[INFO   ] [Kivy        ] v2.0.0rc3, git-Unknown, 20200724
[INFO   ] [Kivy        ] Installed at "C:\Users\%myusername%\AppData\Local\Programs\Python\Python38\lib\kivy\__init__.py"
[INFO   ] [Python      ] v3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)]
[INFO   ] [Python      ] Interpreter at "C:\Users\%myusername%\AppData\Local\Programs\Python\Python38\python.exe"

但是当运行一个简单的hello world文件不起作用时,会显示错误日志:

But when a run a simple hello world file it doesn't work and show the logs with an error:

[INFO   ] [Logger      ] Record log in C:\Users\rapha\.kivy\logs\kivy_20-07-24_20.txt
[INFO   ] [deps        ] Successfully imported "kivy_deps.gstreamer" 0.1.18
[INFO   ] [deps        ] Successfully imported "kivy_deps.angle" 0.1.10
[INFO   ] [deps        ] Successfully imported "kivy_deps.glew" 0.1.12
[INFO   ] [deps        ] Successfully imported "kivy_deps.sdl2" 0.1.23
[INFO   ] [Kivy        ] v2.0.0rc3, git-Unknown, 20200724
[INFO   ] [Kivy        ] Installed at "C:\Users\rapha\AppData\Local\Programs\Python\Python38\lib\kivy\__init__.py"
[INFO   ] [Python      ] v3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)]
[INFO   ] [Python      ] Interpreter at "C:\Users\rapha\AppData\Local\Programs\Python\Python38\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 "test.py", line 1, in <module>
     from kivy.app import App
   File "C:\Users\rapha\AppData\Local\Programs\Python\Python38\lib\kivy\app.py", line 411, in <module>
     from kivy.base import runTouchApp, async_runTouchApp, stopTouchApp
   File "C:\Users\rapha\AppData\Local\Programs\Python\Python38\lib\kivy\base.py", line 28, in <module>
     from kivy.clock import Clock
   File "C:\Users\rapha\AppData\Local\Programs\Python\Python38\lib\kivy\clock.py", line 466, in <module>
     from kivy._clock import CyClockBase, ClockEvent, FreeClockEvent, \
 ModuleNotFoundError: No module named 'kivy._clock'

在加载setup.py之前,它是一个.pyx文件,之后是.c文件,我已经看过文件"_clock".

I've watched the file "_clock", before loading setup.py it's a .pyx file and after it's a .c file.

推荐答案

使用Python 3.7或Kivy的最新alpha版本.

Use Python 3.7 or Kivy's latest alpha release.

您的特定问题是,您正在尝试获取不具有适用于Python 3.8的滚轮的kivy版本,因此python尝试自行构建kivy,但您没有大多数依赖项,并且构建没有工作不正确.我也认为,即使您设置了构建工具链,它也将无法正常工作,因为Python 3.8需要一个小的错误修正(因此,最新的alpha(具有此错误修正的功能可以正常工作).)

Your specific issue is that you're trying to get a version of kivy that doesn't have wheels available for Python 3.8, so python tries to build kivy itself but you don't have most of the dependencies and the build doesn't work right. Also I think it wouldn't work even if you set up the build toolchain, as there's a small bugfix needed for Python 3.8 (hence the latest alpha, which has this bugfix, working).

这篇关于无法使用pip在Windows中安装kivy模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆