无法从/在 PyCharm 中安装 Kivy

Posted

技术标签:

【中文标题】无法从/在 PyCharm 中安装 Kivy【英文标题】:Cannot install Kivy from/in PyCharm 【发布时间】:2017-08-23 20:33:45 【问题描述】:

Win 10 Pro(64 位)、Python 3.6.0、Pyhon 2017.1、Cython 版本 0.23、Visual Studio 2015

我无法从 PyCharm(设置/项目解释器)中安装 Kivy,并尝试了一些方法,例如: - 安装 Visual Studio 2015 - 安装 Cython 0.23 我在另一篇文章中读到了“***”的使用 (I can't install kivy on windows 10 with py3.5),但谁能告诉我如何将其应用于 PyCharm?

错误信息下方:

收集基维 使用缓存的 kivy-1.9.1.tar.gz 已满足要求:Civy-Garden>=0.1.4 in c:\users\Stal\just atrial django project\lib\site-packages(来自 Kivy) 已满足要求:c:\users\Stal\just atrial django project\lib\site-packages 中的请求(来自 Kivy-Garden>=0.1.4->Kivy) 安装收集的包:Kivy 为 Kivy 运行 setup.py install:开始 为 Kivy 运行 setup.py install:完成状态为“错误” 命令 "C:\Users\Stal\Just atrial Django project\Scripts\python.exe" -u -c "import setuptools, tokenize;file='C:\Users\Stal\ 的完整输出AppData\Local\Temp\pycharm-packaging\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\Public \Documents\Wondershare\CreatorTemp\pip-043s8ql1-record\install-record.txt --single-version-externally-managed --compile --install-headers "C:\Users\Stal\Just atrial Django project\include\站点\python3.6\Kivy": 使用 distutils

Detected Cython version 0.23
User distribution detected, avoid portable command.
Windows platform detected, force GLEW usage.
Using this graphics system: OpenGL
WARNING: A problem occured 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 occured 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"

running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\kivy
copying kivy\animation.py -> build\lib.win-amd64-3.6\kivy
copying kivy\app.py -> build\lib.win-amd64-3.6\kivy
copying kivy\atlas.py -> build\lib.win-amd64-3.6\kivy
copying kivy\base.py -> build\lib.win-amd64-3.6\kivy

[……为简洁而编辑…………] 复制 kivy\cache.py -> build\lib.win-amd64-3.6\kivy 创建库 build\temp.win-amd64-3.6\Release\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy_event.cp36-win_amd64.lib 和对象 build\temp.win-amd64-3.6\Release \Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy_event.cp36-win_amd64.exp

Generating code
Finished generating code
cythoning C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\weakproxy.pyx to C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\weakproxy.c
building 'kivy.weakproxy' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-IC:\Users\Stal\Just atrial Django project\include" -IC:\Users\Stal\AppData\Local\Programs\Python\Python36\include -IC:\Users\Stal\AppData\Local\Programs\Python\Python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\winrt" /TcC:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\weakproxy.c /Fobuild\temp.win-amd64-3.6\Release\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\weakproxy.obj
weakproxy.c
C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\weakproxy.c(10691): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\weakproxy.c(10709): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\weakproxy.c(10727): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\weakproxy.c(10901): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\weakproxy.c(10919): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\weakproxy.c(10937): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO "/LIBPATH:C:\Users\Stal\Just atrial Django project\libs" /LIBPATH:C:\Users\Stal\AppData\Local\Programs\Python\Python36\libs /LIBPATH:C:\Users\Stal\AppData\Local\Programs\Python\Python36 "/LIBPATH:C:\Users\Stal\Just atrial Django project\PCbuild\amd64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.14393.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.14393.0\um\x64" /EXPORT:PyInit_weakproxy build\temp.win-amd64-3.6\Release\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\weakproxy.obj /OUT:build\lib.win-amd64-3.6\kivy\weakproxy.cp36-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.6\Release\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\weakproxy.cp36-win_amd64.lib
weakproxy.obj : warning LNK4197: export 'PyInit_weakproxy' specified multiple times; using first specification
   Creating library build\temp.win-amd64-3.6\Release\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\weakproxy.cp36-win_amd64.lib and object build\temp.win-amd64-3.6\Release\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\weakproxy.cp36-win_amd64.exp
Generating code
Finished generating code
cythoning C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\properties.pyx to C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\properties.c
building 'kivy.properties' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-IC:\Users\Stal\Just atrial Django project\include" -IC:\Users\Stal\AppData\Local\Programs\Python\Python36\include -IC:\Users\Stal\AppData\Local\Programs\Python\Python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\winrt" /TcC:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\properties.c /Fobuild\temp.win-amd64-3.6\Release\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\properties.obj
properties.c
C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\properties.c(2303): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\properties.c(2438): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\properties.c(2467): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\properties.c(2496): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\properties.c(35272): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\properties.c(35290): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\properties.c(35308): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\properties.c(35508): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\properties.c(35526): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\properties.c(35544): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO "/LIBPATH:C:\Users\Stal\Just atrial Django project\libs" /LIBPATH:C:\Users\Stal\AppData\Local\Programs\Python\Python36\libs /LIBPATH:C:\Users\Stal\AppData\Local\Programs\Python\Python36 "/LIBPATH:C:\Users\Stal\Just atrial Django project\PCbuild\amd64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.14393.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.14393.0\um\x64" /EXPORT:PyInit_properties build\temp.win-amd64-3.6\Release\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\properties.obj /OUT:build\lib.win-amd64-3.6\kivy\properties.cp36-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.6\Release\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\properties.cp36-win_amd64.lib
properties.obj : warning LNK4197: export 'PyInit_properties' specified multiple times; using first specification
   Creating library build\temp.win-amd64-3.6\Release\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\properties.cp36-win_amd64.lib and object build\temp.win-amd64-3.6\Release\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\properties.cp36-win_amd64.exp
Generating code
Finished generating code
cythoning C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\graphics/buffer.pyx to C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\graphics\buffer.c
building 'kivy.graphics.buffer' extension
creating build\temp.win-amd64-3.6\Release\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\graphics
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-IC:\Users\Stal\Just atrial Django project\include" -IC:\Users\Stal\AppData\Local\Programs\Python\Python36\include -IC:\Users\Stal\AppData\Local\Programs\Python\Python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\winrt" /TcC:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\graphics\buffer.c /Fobuild\temp.win-amd64-3.6\Release\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\graphics\buffer.obj
buffer.c
C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\graphics\buffer.c(2718): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\graphics\buffer.c(2736): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\graphics\buffer.c(2754): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\graphics\buffer.c(2954): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\graphics\buffer.c(2972): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\graphics\buffer.c(2990): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO "/LIBPATH:C:\Users\Stal\Just atrial Django project\libs" /LIBPATH:C:\Users\Stal\AppData\Local\Programs\Python\Python36\libs /LIBPATH:C:\Users\Stal\AppData\Local\Programs\Python\Python36 "/LIBPATH:C:\Users\Stal\Just atrial Django project\PCbuild\amd64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.14393.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.14393.0\um\x64" /EXPORT:PyInit_buffer build\temp.win-amd64-3.6\Release\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\graphics\buffer.obj /OUT:build\lib.win-amd64-3.6\kivy\graphics\buffer.cp36-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.6\Release\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\graphics\buffer.cp36-win_amd64.lib
buffer.obj : warning LNK4197: export 'PyInit_buffer' specified multiple times; using first specification
   Creating library build\temp.win-amd64-3.6\Release\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\graphics\buffer.cp36-win_amd64.lib and object build\temp.win-amd64-3.6\Release\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\graphics\buffer.cp36-win_amd64.exp
Generating code
Finished generating code
cythoning C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\graphics/context.pyx to C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\graphics\context.c
building 'kivy.graphics.context' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-IC:\Users\Stal\Just atrial Django project\include" -IC:\Users\Stal\AppData\Local\Programs\Python\Python36\include -IC:\Users\Stal\AppData\Local\Programs\Python\Python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\winrt" /TcC:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\graphics\context.c /Fobuild\temp.win-amd64-3.6\Release\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\kivy\graphics\context.obj
context.c
c:\users\Stal\appdata\local\temp\pycharm-packaging\kivy\kivy\graphics\gl_redirect.h(8): fatal error C1083: Cannot open include file: 'GL/glew.h': No such file or directory
 error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

----------------------------------------

Command ""C:\Users\Stal\Just atrial Django project\Scripts\python.exe" -u -c "import setuptools, tokenize;file='C:\Users\Stal \AppData\Local\Temp\pycharm-packaging\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\ Public\Documents\Wondershare\CreatorTemp\pip-043s8ql1-record\install-record.txt --single-version-externally-managed --compile --install-headers "C:\Users\Stal\Just atrial Django project\include \site\python3.6\Kivy"" 失败,错误代码 1 在 C:\Users\Stal\AppData\Local\Temp\pycharm-packaging\Kivy\

【问题讨论】:

问题叫RTFM; kivi 有很好的安装手册,如果你去阅读它说它适用于高达 3.4 的 python,但不适用于 3.5 和 3.6 .... 【参考方案1】:

如果有一种简单的方法,为什么还要为复杂的过程而烦恼。 使用夜间轮绕过 cython 安装。见https://kivy.org/docs/installation/installation-windows.html

您从 Windows 命令提示符进行安装。不是 python 解释器。

【讨论】:

【参考方案2】:

传统上应该使用 pip 安装 Kivy。简短回答:由于依赖项,Kivy 在虚拟环境中表现不佳您的特定错误是由于 Kivy 无法与 OpenGL 通信,这是 Kivy 的基本依赖项。

WINDOWS (cmd):

pip install --upgrade kivy

LINUX(终端):

sudo pip3 install --upgrade kivy

然后通过以下方式确认它已正确安装:

>> python3
>> import Kivy

【讨论】:

【参考方案3】:

它对我和 Windows 10 的作用是:

python -m pip install kivy

【讨论】:

以上是关于无法从/在 PyCharm 中安装 Kivy的主要内容,如果未能解决你的问题,请参考以下文章

无法在 PyCharm 中安装 PyTorch(Python 3.9 / macOS)

在虚拟环境python 2.7 pycharm中安装后无法导入请求

在PyCharm社区版中安装mysql

pycharm安装不了time库

在 pycharm 中安装 cv2 时出错 - python 3.5.3

在 PyCharm 中安装 Django [重复]