使用Anaconda Python 3.6在Windows 7上安装Kivy

时间:2017-03-28 09:04:46

标签: android python kivy

我正在尝试使用python在我的Windows 7 PC上安装Kivy以进行Android开发。

我已按照此处提到的步骤进行操作。kivy installation on Windows

我收到

的以下错误

python -m pip install kivy

第一个错误

  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\OEM\Anaconda3\libs /LIBPATH:C:\Users\OEM\Anaconda3\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.10586.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.10586.0\um\x64" /EXPORT:PyInit_buffer build\temp.win-amd64-3.6\Release\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\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\OEM\AppData\Local\Temp\pip-build-jmayz55y\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\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics\buffer.cp36-win_amd64.lib and object build\temp.win-amd64-3.6\Release\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics\buffer.cp36-win_amd64.exp
  Generating code
  Finished generating code
  cythoning C:\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics/context.pyx to C:\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\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\OEM\Anaconda3\include -IC:\Users\OEM\Anaconda3\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.10586.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\winrt" /TcC:\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics\context.c /Fobuild\temp.win-amd64-3.6\Release\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics\context.obj
  context.c
  c:\users\oem\appdata\local\temp\pip-build-jmayz55y\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

  ----------------------------------------
  Running setup.py clean for kivy
Failed to build kivy
Installing collected packages: kivy
  Running setup.py install for kivy: started
    Running setup.py install for kivy: finished with status 'error'
    Complete output from command C:\Users\OEM\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\OEM\\AppData\\Local\\Temp\\pip-build-jmayz55y\\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\OEM\AppData\Local\Temp\pip-wg_pau0w-record\install-record.txt --single-version-externally-managed --compile:
    Using distutils

    Detected Cython version 0.25.2
      This version of Cython is untested with Kivy. While this version may
      work perfectly fine, it is possible that you may experience issues. If
      you do have issues, please downgrade to a supported version. It is
      best to use the newest supported version, 0.23, but the minimum
      supported version is 0.20.

      If your platform provides a Cython package, check if you can downgrade
      to a supported version. Otherwise, uninstall the platform package and
      install Cython via pip:

        pip install -I Cython==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"

第二个错误:

    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\OEM\Anaconda3\libs /LIBPATH:C:\Users\OEM\Anaconda3\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.10586.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.10586.0\um\x64" /EXPORT:PyInit_buffer build\temp.win-amd64-3.6\Release\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\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\OEM\AppData\Local\Temp\pip-build-jmayz55y\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\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics\buffer.cp36-win_amd64.lib and object build\temp.win-amd64-3.6\Release\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics\buffer.cp36-win_amd64.exp
    Generating code
    Finished generating code
    skipping 'C:\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics\context.c' Cython extension (up-to-date)
    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\OEM\Anaconda3\include -IC:\Users\OEM\Anaconda3\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.10586.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\winrt" /TcC:\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics\context.c /Fobuild\temp.win-amd64-3.6\Release\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics\context.obj
    context.c
    c:\users\oem\appdata\local\temp\pip-build-jmayz55y\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

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

安装有什么问题?

2 个答案:

答案 0 :(得分:1)

从您的第一条错误消息中,您的cython版本可能是罪魁祸首。根据kivy docs:

  

这个版本的Kivy至少需要Cython版本0.23,并且已经通过0.23进行了测试。以后的版本可能会有效,但由于它们尚未经过测试,因此无法保证。

在安装kivy之前,请尝试安装特定的cython版本0.23。

pip install cython==0.23

然后重复安装kivy。

答案 1 :(得分:0)

Py35 +支持仅在最近才添加,因此Kivy 1.9.1版本(在pypi上)不会在py35 +上工作。

使其工作从源代码编译:

pip install https://github.com/kivy/kivy/zipball/master

或使用完全位于同一文档页面上的轮子。