iMac Monterey 12.6.3系统下pygame安装失败的问题求助
各位开发者好,我在iMac Monterey 12.6.3系统上安装pygame时遇到了无法解决的问题,已经尝试过两种方法都失败了:
- 按照一篇2015年的教程逐步操作
- 分别在Python终端和Mac系统终端中使用pip命令安装
每次安装都会触发相同的错误,核心提示是pkg-config: command not found,最终导致元数据生成失败,完整错误信息如下:
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 did not run successfully.
│ exit code: 1
╰─> [34 lines of output]
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 "", line 2, in
File "", line 34, in
File "/private/var/folders/82/gx_9dw5926nd_8h271w_4fp00000gn/T/pip-install-r0d2u6u4/pygame_7a53717a6a7b41a5a1e4d3f23d0f3159/setup.py", line 359, in
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] note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> See above for output. note: This is an issue with the package mentioned above, not pip. hint: See above for details.
我已经快束手无策了,有没有大佬能指点一下,到底需要做什么才能成功安装pygame?非常感谢大家的帮助!
备注:内容来源于stack exchange,提问作者Tiny

