无法在 iMac 12.6.3 Monterey 上安装 pygame

无法在 iMac 12.6.3 Monterey 上安装 pygame

我已经关注https://brysonpayne.com/2015/01/10/setting-up-pygame-on-a-mac/

我也尝试通过 python 终端和 Mac 终端安装它,但我不断收到以下错误消息:

  Using cached pygame-2.1.2.tar.gz (10.1 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

× python setup.py egg_info 未成功运行。│ 退出代码:1 ╰─> [34 行输出]

  WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
  Using Darwin configuration...
  
  /bin/sh: pkg-config: command not found
  /bin/sh: pkg-config: command not found
  /bin/sh: pkg-config: command not found
  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "/private/var/folders/82/gx_9dw5926nd_8h271w_4fp00000gn/T/pip-install-r0d2u6u4/pygame_7a53717a6a7b41a5a1e4d3f23d0f3159/setup.py", line 359, in <module>
      buildconfig.config.main(AUTO_CONFIG)
    File "/private/var/folders/82/gx_9dw5926nd_8h271w_4fp00000gn/T/pip-install-r0d2u6u4/pygame_7a53717a6a7b41a5a1e4d3f23d0f3159/buildconfig/config.py", line 225, in main
      deps = CFG.main(**kwds)
             ^^^^^^^^^^^^^^^^
    File "/private/var/folders/82/gx_9dw5926nd_8h271w_4fp00000gn/T/pip-install-r0d2u6u4/pygame_7a53717a6a7b41a5a1e4d3f23d0f3159/buildconfig/config_darwin.py", line 143, in main
      find_freetype(),
      ^^^^^^^^^^^^^^^
    File "/private/var/folders/82/gx_9dw5926nd_8h271w_4fp00000gn/T/pip-install-r0d2u6u4/pygame_7a53717a6a7b41a5a1e4d3f23d0f3159/buildconfig/config_darwin.py", line 110, in find_freetype
      pkg_config = DependencyProg(
                   ^^^^^^^^^^^^^^^
    File "/private/var/folders/82/gx_9dw5926nd_8h271w_4fp00000gn/T/pip-install-r0d2u6u4/pygame_7a53717a6a7b41a5a1e4d3f23d0f3159/buildconfig/config_unix.py", line 39, in __init__
      self.ver = config[0].strip()
                 ~~~~~~^^^
  IndexError: list index out of range
  
  ---
  For help with compilation see:
      https://www.pygame.org/wiki/MacCompile
  To contribute to pygame development see:
      https://www.pygame.org/contribute.html
  ---
  
  [end of output]

注意:此错误源自子进程,可能不是 pip 的问题。错误:元数据生成失败

× 生成包元数据时遇到错误。╰─> 请参见上文了解输出。

注意:这是上面提到的包的问题,​​而不是 pip 的问题。提示:详情请参阅上文。

我已经束手无策了。我需要做什么才能让 pygame 加载。提前感谢你的帮助

相关内容