微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决使用 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 举报,一经查实,本站将立刻删除。