使用 Python 3.8 在 Mac M1 上安装 pygame 的问题

问题描述

我能够使用以下方法在 Mac M1 上安装 pygame:
<Typography>
尽管在安装过程中没有出现错误,但我在尝试导入 pip install pygame==1.9.6 时得到以下信息,例如:

pygame
import pygame

什么时候可能是这个问题的根源?我不确定我将如何解决这个错误,也不确定这意味着什么。

编辑

如果我尝试安装最新版本:
Traceback (most recent call last): File "<string>",line 1,in <module> File "/Users/ryanrudes/miniforge3/envs/ml/lib/python3.8/site-packages/pygame/__init__.py",line 133,in <module> from pygame.base import * ImportError: dlopen(/Users/ryanrudes/miniforge3/envs/ml/lib/python3.8/site-packages/pygame/base.cpython-38-darwin.so,2): Symbol not found: _SDL_EnableuNICODE Referenced from: /Users/ryanrudes/miniforge3/envs/ml/lib/python3.8/site-packages/pygame/base.cpython-38-darwin.so Expected in: flat namespace in /Users/ryanrudes/miniforge3/envs/ml/lib/python3.8/site-packages/pygame/base.cpython-38-darwin.so
我收到一个很长的 pip install -U pygame 错误,以以下内容结尾:

gcc

以下是完整命令输出摘要

ERROR: Command errored out with exit status 1: /Users/ryanrudes/miniforge3/envs/ml/bin/python3.8 -u -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'/private/var/folders/v8/xbqyyrhx7mxd_dcm9x9jf8tc0000gn/T/pip-install-s7axfi8b/pygame_d79133ea00834293bb7b8163896e7345/setup.py'"'"'; __file__='"'"'/private/var/folders/v8/xbqyyrhx7mxd_dcm9x9jf8tc0000gn/T/pip-install-s7axfi8b/pygame_d79133ea00834293bb7b8163896e7345/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/v8/xbqyyrhx7mxd_dcm9x9jf8tc0000gn/T/pip-record-5eo2sjax/install-record.txt --single-version-externally-managed --compile --install-headers /Users/ryanrudes/miniforge3/envs/ml/include/python3.8/pygame Check the logs for full command output.

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)