I am trying to install the pygame library on my Mac running macOS 11.0 Big Sur, but I keep getting errors related to missing files, such as 'longintrepr.h' and 'pkg-config'. I have tried installing the library using pip3 and a virtual environment, but I am still encountering the same issues. I am looking for a solution to successfully install the pygame library on my Mac.
#include "longintrepr.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 '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> pygame
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
I have the newest version of python3 installed.
I tried to install pygame using pip on my MacOS machine but I encountered an error "src_c/_sdl2/sdl2.c:211:12: fatal error: 'longintrepr.h' file not found" during the installation process. I also tried creating a virtual environment and installing pygame there but still encountered the same error. I was expecting the installation process to complete successfully without any errors.
CodePudding user response:
On the official pygame repo, there's a huge thread regarding installation of pygame in python 3.11 (latest version) not working properly yet.
Try installing pip install pygame --pre
for now, which is going to install a developmental release of the newest, prereleased pygame version, or if you want stability using an older version of python also works.