在 Win 10 上安装 Kivy 的问题

Issues installing Kivy on Win 10

在 windows 10.

上安装 Kivy 时遇到问题

根据 https://kivy.org/doc/stable/installation/installation-windows.html 的说明安装了所有东西,除了 kivy 本身,其他都已安装。我正在使用 Python 3.9.0。也无法正确安装 PyQT,但不知何故解决了

错误信息:

C:\WINDOWS\system32>python -m pip install kivy==1.11.1
Collecting kivy==1.11.1
  Using cached Kivy-1.11.1.tar.gz (23.6 MB)
Requirement already satisfied: Kivy-Garden>=0.1.4 in c:\users\megaa\appdata\roaming\python\python38\site-packages (from kivy==1.11.1) (0.1.4)
Requirement already satisfied: docutils in c:\users\megaa\appdata\roaming\python\python38\site-packages (from kivy==1.11.1) (0.16)
Requirement already satisfied: pygments in c:\users\megaa\appdata\roaming\python\python38\site-packages (from kivy==1.11.1) (2.7.2)
Requirement already satisfied: requests in c:\users\megaa\appdata\roaming\python\python38\site-packages (from Kivy-Garden>=0.1.4->kivy==1.11.1) (2.23.0)
Requirement already satisfied: idna<3,>=2.5 in c:\users\megaa\appdata\roaming\python\python38\site-packages (from requests->Kivy-Garden>=0.1.4->kivy==1.11.1) (2.9)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\users\megaa\appdata\roaming\python\python38\site-packages (from requests->Kivy-Garden>=0.1.4->kivy==1.11.1) (1.25.9)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\megaa\appdata\roaming\python\python38\site-packages (from requests->Kivy-Garden>=0.1.4->kivy==1.11.1) (2020.4.5.1)
Requirement already satisfied: chardet<4,>=3.0.2 in c:\users\megaa\appdata\roaming\python\python38\site-packages (from requests->Kivy-Garden>=0.1.4->kivy==1.11.1) (3.0.4)
Building wheels for collected packages: kivy
  Building wheel for kivy (setup.py) ... error
  ERROR: Command errored out with exit status 3221225477:
   command: 'C:\Program Files\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\megaa\AppData\Local\Temp\pip-install-57g12q0m\kivy\setup.py'"'"'; __file__='"'"'C:\Users\megaa\AppData\Local\Temp\pip-install-57g12q0m\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\megaa\AppData\Local\Temp\pip-wheel-xeoguf6o'
       cwd: C:\Users\megaa\AppData\Local\Temp\pip-install-57g12q0m\kivy\
  Complete output (531 lines):
  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: Failed building wheel for kivy
  Running setup.py clean for kivy
Failed to build kivy
Installing collected packages: kivy
    Running setup.py install for kivy ... error
    ERROR: Command errored out with exit status 3221225477:
     command: 'C:\Program Files\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\megaa\AppData\Local\Temp\pip-install-57g12q0m\kivy\setup.py'"'"'; __file__='"'"'C:\Users\megaa\AppData\Local\Temp\pip-install-57g12q0m\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\megaa\AppData\Local\Temp\pip-record-0l_k634_\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Program Files\Python38\Include\kivy'
         cwd: C:\Users\megaa\AppData\Local\Temp\pip-install-57g12q0m\kivy\
    Complete output (513 lines):
    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"

    fatal: not a git repository (or any of the parent directories): .git
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.8
    creating build\lib.win-amd64-3.8\kivy

    ----------------------------------------
ERROR: Command errored out with exit status 3221225477: 'C:\Program Files\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\megaa\AppData\Local\Temp\pip-install-57g12q0m\kivy\setup.py'"'"'; __file__='"'"'C:\Users\megaa\AppData\Local\Temp\pip-install-57g12q0m\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\megaa\AppData\Local\Temp\pip-record-0l_k634_\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Program Files\Python38\Include\kivy' Check the logs for full command output.
python

如果您安装了 python 3.8,那么 Kivy 1.11.1 将无法运行。因为开发人员没有为 python 3.8 发布 Kivy 1.11.1 wheel。我也遇到了同样的问题,但只是在 SO 和 kivy 安装文档中找到了解决方案。他们提到这将适用于 python 2.7 和 3.5 到 3.7。

您可以下载python 3.7 或尝试kivy 的预发布(master)版本。直接去pypi看命令就可以了