M1 Mac - 安装 pygame 2.0 [重复]
Posted
技术标签:
【中文标题】M1 Mac - 安装 pygame 2.0 [重复]【英文标题】:M1 Mac - Installing pygame 2.0 [duplicate] 【发布时间】:2021-12-14 02:14:38 【问题描述】:我最近有一个新的 M1 MacBook Pro,我一直在尝试让 pygame 工作一段时间,我尝试了许多不同的步骤来实现,但遇到了很多问题。我已经安装了 homebrew 和 pyenv 并在阳光下使用了所有终端命令,但无济于事。我设法安装了 1.9.6,但不幸的是它没有运行我的项目,因为我收到了这个错误:
Unable to obtain graphics context for NSWindow (Mojave behavior)
当尝试在终端中安装更高版本时,我遇到了这个错误:
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
【问题讨论】:
【参考方案1】:尚不支持M1,请参阅:https://github.com/pygame/pygame/issues/2452
【讨论】:
那很不方便。希望随着专业人士的发布,它很快就会得到原生支持。 支持M1,只是没有***。尝试按照此处的步骤操作:pygame.org/wiki/MacCompile以上是关于M1 Mac - 安装 pygame 2.0 [重复]的主要内容,如果未能解决你的问题,请参考以下文章