当我在终端输入 python3 -m pip install pygame 时出现这个错误 其中说
python3 -m pip install pygame 收集pygame 使用缓存的 pygame-2.0.1.tar.gz (5.5 MB) 错误:命令出错,退出状态为 1: 命令:/Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/5m/kkqqlrrn4q3_03fs2mjvm42r0000gn/T/pip-install-ycs4g5ez/pygame_a9faec7f59ae45c685bc5178fb716e'; file='"'"'/private/var/folders/5m/kkqqlrrn4q3_03fs2mjvm42r0000gn/T/pip-install-ycs4g5ez/pygame_a9faec7f59ae45c685bc5178fb716ae2/get'set' '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"' from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"' "');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /private/var/文件夹/5m/kkqqlrrn4q3_03fs2mjvm42r0000gn/T/pip-pip-egg-info-zcnf9tzs cwd:/private/var/folders/5m/kkqqlrrn4q3_03fs2mjvm42r0000gn/T/pip-install-ycs4g5ez/pygame_a9faec7f59ae45c685bc5178fb716ae2/ 完整输出(27 行):
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using Darwin configuration...
/bin/sh: sdl2-config: command not found
/bin/sh: sdl2-config: command not found
/bin/sh: sdl2-config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/5m/kkqqlrrn4q3_03fs2mjvm42r0000gn/T/pip-install-ycs4g5ez/pygame_a9faec7f59ae45c685bc5178fb716ae2/setup.py", line 318, in <module>
buildconfig.config.main(AUTO_CONFIG)
File "/private/var/folders/5m/kkqqlrrn4q3_03fs2mjvm42r0000gn/T/pip-install-ycs4g5ez/pygame_a9faec7f59ae45c685bc5178fb716ae2/buildconfig/config.py", line 221, in main
deps = CFG.main(**kwds)
File "/private/var/folders/5m/kkqqlrrn4q3_03fs2mjvm42r0000gn/T/pip-install-ycs4g5ez/pygame_a9faec7f59ae45c685bc5178fb716ae2/buildconfig/config_darwin.py", line 131, in main
[DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl'])],
File "/private/var/folders/5m/kkqqlrrn4q3_03fs2mjvm42r0000gn/T/pip-install-ycs4g5ez/pygame_a9faec7f59ae45c685bc5178fb716ae2/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
---
----------------------------------------
警告:丢弃 https://files.pythonhosted.org/packages/c7/b8/06e02c7cca7aec915839927a9aa19f749ac17a3d2bb2610b945d2de0aa96/pygame-2.0.1.tar.gz#sha256=8b1e7b63f47aafcdd8849933b206778747ef1802bd3d526aca45ed77141e4001(来自 https://pypi.org/simple/pygame/)。命令出错,退出状态为 1:python setup.py egg_info 检查日志以获取完整的命令输出。
然后通过使用较旧的 pygame 版本(例如 使用缓存的 pygame-2.0.0.tar.gz (5.5 MB): 然后显示与上述类似的错误,并且在 pygame-1.9.6 等中重复出现
在最后几行它说: 错误:命令出错,退出状态为 1:/Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/5m/kkqqlrrn4q3_03fs2mjvm42r0000gn/T/pip-install-ycs4g5ez/pygame_de33c4b632d944c0a668bdea04/"up"3; file='"'"'/private/var/folders/5m/kkqqlrrn4q3_03fs2mjvm42r0000gn/T/pip-install-ycs4g5ez/pygame_de33c4b632d944c0a668bdea0295up31fize(getfs2mjvm42r0000gn) '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"' from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"' "');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/ 5m/kkqqlrrn4q3_03fs2mjvm42r0000gn/T/pip-record-6vzh4noi/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.9/include/python3 .9/pygame 检查日志以获取完整的命令输出。