简体   繁体   中英

M1 Mac - Installing pygame 2.0

I've recently got a new M1 MacBook Pro and I've been trying to get pygame to work for a while now and I've tried numerous different steps to get there but having many issues. I've installed homebrew and pyenv and used all terminal commands under the sun but no avail. I managed to get 1.9.6 installed but unfortunately it doesn't run my project as I get this error:

Unable to obtain graphics context for NSWindow (Mojave behavior)

When trying to install a later version in the terminal, I am greeted with this error:

Collecting pygame==2.0.0
 Using cached pygame-2.0.0.tar.gz (5.5 MB)
 Preparing metadata (setup.py) ... error
 ERROR: Command errored out with exit status 1:
  command: /Users/callum/.pyenv/versions/3.10.0/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/3f/6rcvf1vd6w1blqkdzmr2xxj80000gn/T/pip-install-m3vkf9df/pygame_ed8c66de322048c4997690a77252f209/setup.py'"'"'; __file__='"'"'/private/var/folders/3f/6rcvf1vd6w1blqkdzmr2xxj80000gn/T/pip-install-m3vkf9df/pygame_ed8c66de322048c4997690a77252f209/setup.py'"'"';f = getattr(tokenize, '"'"'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/folders/3f/6rcvf1vd6w1blqkdzmr2xxj80000gn/T/pip-pip-egg-info-wb44lvli
      cwd: /private/var/folders/3f/6rcvf1vd6w1blqkdzmr2xxj80000gn/T/pip-install-m3vkf9df/pygame_ed8c66de322048c4997690a77252f209/
 Complete output (27 lines):
 
 
 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/3f/6rcvf1vd6w1blqkdzmr2xxj80000gn/T/pip-install-m3vkf9df/pygame_ed8c66de322048c4997690a77252f209/setup.py", line 318, in <module>
     buildconfig.config.main(AUTO_CONFIG)
   File "/private/var/folders/3f/6rcvf1vd6w1blqkdzmr2xxj80000gn/T/pip-install-m3vkf9df/pygame_ed8c66de322048c4997690a77252f209/buildconfig/config.py", line 221, in main
     deps = CFG.main(**kwds)
   File "/private/var/folders/3f/6rcvf1vd6w1blqkdzmr2xxj80000gn/T/pip-install-m3vkf9df/pygame_ed8c66de322048c4997690a77252f209/buildconfig/config_darwin.py", line 131, in main
     [DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl'])],
   File "/private/var/folders/3f/6rcvf1vd6w1blqkdzmr2xxj80000gn/T/pip-install-m3vkf9df/pygame_ed8c66de322048c4997690a77252f209/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
 ---
 
 ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/bc/0c/d164411381bada8feae57359aa9296defbed3035f4b55bef6a271cb0573c/pygame-2.0.0.tar.gz#sha256=63b038da116a643046181b02173fd894d87d2f85ecfd6aa7d5ece73c6ef501e9 (from https://pypi.org/simple/pygame/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement pygame==2.0.0 (from versions: 1.9.2rc1, 1.9.2, 1.9.3, 1.9.4.dev0, 1.9.4rc1, 1.9.4, 1.9.5rc1, 1.9.5rc2, 1.9.5, 1.9.6rc1, 1.9.6rc2, 1.9.6, 2.0.0.dev1, 2.0.0.dev2, 2.0.0.dev3, 2.0.0.dev4, 2.0.0.dev6, 2.0.0.dev8, 2.0.0.dev10, 2.0.0.dev12, 2.0.0.dev14, 2.0.0.dev16, 2.0.0.dev18, 2.0.0.dev20, 2.0.0.dev22, 2.0.0.dev24, 2.0.0, 2.0.1.dev1, 2.0.1, 2.0.2.dev2, 2.0.2.dev4, 2.0.2, 2.0.3.dev2, 2.0.3.dev4)
ERROR: No matching distribution found for pygame==2.0.0```




Honestly I'm not too sure how to make any sense of this, and I'm wondering if its a macOS Monterey issue perhaps?

Any help is greatly appreciated

尚不支持 M1,请参阅: https : //github.com/pygame/pygame/issues/2452

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM