【发布时间】:2020-12-11 08:03:08
【问题描述】:
我正在使用 PyCharm for MacOS 和 Python 3,而 MacOS 默认的 Python 是 Python 2.7.3。我正在尝试安装 PyGame 模块以在 PyCharm 上使用。对于 docx 等其他模块,python3 -m pip install docx 有效,但对于 PyGame,python3 -m pip install PyGame 无效。
它显示了这个错误:
In file included from src_c/gfxdraw.c:33:
In file included from src_c/pygame.h:32:
src_c/_pygame.h:216:10: fatal error: 'SDL.h' file not found
#include <SDL.h>
^~~~~~~
1 error generated.
---
For help with compilation see:
https://www.pygame.org/wiki/MacCompile
To contribute to pygame development see:
https://www.pygame.org/contribute.html
---
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1:
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3 -u -c 'import sys, setuptools,
tokenize; sys.argv[0] = '"'"'/private/var/folders/3m/w8365k4s59qfzct1l8ph77fh0000gn/T/pip-
install-oijhzzti/PyGame/setup.py'"'"';
__file__='"'"'/private/var/folders/3m/w8365k4s59qfzct1l8ph77fh0000gn/T/pip-install-
oijhzzti/PyGame/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open).
(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code,
__file__, '"'"'exec'"'"'))' install --record
/private/var/folders/3m/w8365k4s59qfzct1l8ph77fh0000gn/T/pip-record-598hwe63/install-
record.txt --single-version-externally-managed --compile --install-headers
/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/PyGame Check the logs
for full command output.
我能做什么?
【问题讨论】:
标签: python python-3.x pygame macos-catalina