1

I am using PyCharm for MacOS with Python 3 and the MacOS default Python is Python 2.7.3. I am trying to install PyGame module to use on PyCharm. For other modules like docx, python3 -m pip install docx works, but for PyGame python3 -m pip install PyGame doesn't.

It shows this error:

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.

What can I do?

martineau
  • 119,623
  • 25
  • 170
  • 301

1 Answers1

1

Try doing pip3 install PyGame.

kantuni
  • 442
  • 2
  • 9