本版
查看: 14127|回复: 9

[小调查] pip 安装 pygame库报错

[复制链接]

[Lv.7]特大萝卜

You're the {css} to my html.

楼主(1#)
发表于 2022-12-2 15:27:25 | 只看该作者 |只看大图 |倒序浏览 |阅读模式
[color=rgb(0, 0, 0)][size=11px]xxxxx@xxx ~ % pip3 install pygame [/size][/color]
[color=rgb(0, 0, 0)][size=11px]
[/size]
[/color]
[color=rgb(0, 0, 0)][size=11px]Collecting pygame[/size][/color]
[color=rgb(0, 0, 0)][size=11px] Using cached pygame-2.1.2.tar.gz (10.1 MB)[/size][/color]
[color=rgb(0, 0, 0)][size=11px] Preparing metadata (setup.py) ... error[/size][/color]
[color=rgb(0, 0, 0)][size=11px] error: subprocess-exited-with-error[/size][/color]
[color=rgb(0, 0, 0)][size=11px] [/size][/color]
[color=rgb(0, 0, 0)][size=11px] × python setup.py egg_info did not run successfully.[/size][/color]
[color=rgb(0, 0, 0)][size=11px] │ exit code: 1[/size][/color]
[color=rgb(180, 36, 25)][size=11px] ╰─> [31 lines of output][/size][/color]
[color=rgb(0, 0, 0)][size=11px] [/size][/color]
[color=rgb(0, 0, 0)][size=11px] [/size][/color]
[color=rgb(0, 0, 0)][size=11px] WARNING, No "Setup" File Exists, Running "buildconfig/config.py"[/size][/color]
[color=rgb(0, 0, 0)][size=11px] Using Darwin configuration...[/size][/color]
[color=rgb(0, 0, 0)][size=11px] [/size][/color]
[color=rgb(0, 0, 0)][size=11px] /bin/sh: sdl2-config: command not found[/size][/color]
[color=rgb(0, 0, 0)][size=11px] /bin/sh: sdl2-config: command not found[/size][/color]
[color=rgb(0, 0, 0)][size=11px] /bin/sh: sdl2-config: command not found[/size][/color]
[color=rgb(0, 0, 0)][size=11px] Traceback (most recent call last):[/size][/color]
[color=rgb(0, 0, 0)][size=11px] File "<string>", line 2, in <module>[/size][/color]
[color=rgb(0, 0, 0)][size=11px] File "<pip-setuptools-caller>", line 34, in <module>[/size][/color]
[color=rgb(0, 0, 0)][size=11px] File "/private/var/folders/d6/91by9vm14zzbthyv2bxc6w9h0000gn/T/pip-install-9fxzjx5h/pygame_ab6a1c17b0ce4397b0cd85eea3da1c0f/setup.py", line 359, in <module>[/size][/color]
[color=rgb(0, 0, 0)][size=11px] buildconfig.config.main(AUTO_CONFIG)[/size][/color]
[color=rgb(0, 0, 0)][size=11px] File "/private/var/folders/d6/91by9vm14zzbthyv2bxc6w9h0000gn/T/pip-install-9fxzjx5h/pygame_ab6a1c17b0ce4397b0cd85eea3da1c0f/buildconfig/config.py", line 225, in main[/size][/color]
[color=rgb(0, 0, 0)][size=11px] deps = CFG.main(**kwds)[/size][/color]
[color=rgb(0, 0, 0)][size=11px] ^^^^^^^^^^^^^^^^[/size][/color]
[color=rgb(0, 0, 0)][size=11px] File "/private/var/folders/d6/91by9vm14zzbthyv2bxc6w9h0000gn/T/pip-install-9fxzjx5h/pygame_ab6a1c17b0ce4397b0cd85eea3da1c0f/buildconfig/config_darwin.py", line 132, in main[/size][/color]
[color=rgb(0, 0, 0)][size=11px] [DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl'])],[/size][/color]
[color=rgb(0, 0, 0)][size=11px] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^[/size][/color]
[color=rgb(0, 0, 0)][size=11px] File "/private/var/folders/d6/91by9vm14zzbthyv2bxc6w9h0000gn/T/pip-install-9fxzjx5h/pygame_ab6a1c17b0ce4397b0cd85eea3da1c0f/buildconfig/config_unix.py", line 39, in __init__[/size][/color]
[color=rgb(0, 0, 0)][size=11px] self.ver = config[0].strip()[/size][/color]
[color=rgb(0, 0, 0)][size=11px] ~~~~~~^^^[/size][/color]
[color=rgb(0, 0, 0)][size=11px] IndexError: list index out of range[/size][/color]
[color=rgb(0, 0, 0)][size=11px] [/size][/color]
[color=rgb(0, 0, 0)][size=11px] ---[/size][/color]
[color=rgb(0, 0, 0)][size=11px] For help with compilation see:[/size][/color]
[color=rgb(0, 0, 0)][size=11px] https://www.pygame.org/wiki/MacCompile[/size][/color]
[color=rgb(0, 0, 0)][size=11px] To contribute to pygame development see:[/size][/color]
[color=rgb(0, 0, 0)][size=11px] https://www.pygame.org/contribute.html[/size][/color]
[color=rgb(0, 0, 0)][size=11px] ---[/size][/color]
[color=rgb(0, 0, 0)][size=11px] [/size][/color]
[color=rgb(180, 36, 25)][size=11px] [end of output][/size][/color]
[color=rgb(0, 0, 0)][size=11px] [/size][/color]
[color=rgb(0, 0, 0)][size=11px] note: This error originates from a subprocess, and is likely not a problem with pip.[/size][/color]
[color=rgb(0, 0, 0)][size=11px]error: metadata-generation-failed[/size][/color]
[color=rgb(0, 0, 0)][size=11px]
[/size]
[/color]
[color=rgb(0, 0, 0)][size=11px]× Encountered error while generating package metadata.[/size][/color]
[color=rgb(0, 0, 0)][size=11px]╰─> See above for output.[/size][/color]
[color=rgb(0, 0, 0)][size=11px]
[/size]
[/color]
[color=rgb(0, 0, 0)][size=11px]note: This is an issue with the package mentioned above, not pip.[/size][/color]
[color=rgb(0, 0, 0)][size=11px]hint: See above for details.[/size][/color]
怎么说 我算是python新手 遇到这问题真的束手无策 baidu.com不解决问题

Ace_qingfeng
Qingfeng_129
回复

支持 | 反对  0 支持 / 0 反对 评分 举报

[Lv.8]超级萝卜

沙发(2#)
发表于 2022-12-2 15:43:35 | 只看该作者
本帖最后由 wdscxsj 于 2022-12-2 15:49 编辑

如果是 Windows 系统,可以从这下载编译好的 .whl 版本:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame

Linux 系统(如 Ubuntu)可以安装系统源的发布包。其它系统(如 macOS)可能需要安装相关库并自行编译,也可以使用 Anaconda Mac 的包。具体参见 Pygame 文档(https://www.pygame.org/wiki/GettingStarted)。

[Lv.7]特大萝卜

You're the {css} to my html.

板凳(3#)
 楼主| 发表于 2022-12-2 18:02:02 | 只看该作者
wdscxsj 发表于 2022-12-2 15:43
如果是 Windows 系统,可以从这下载编译好的 .whl 版本:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#py ...

感谢 我这就去试下
Ace_qingfeng
Qingfeng_129

[Lv.8]超级萝卜

地板(4#)
发表于 2022-12-2 18:58:42 | 只看该作者
谢谢,遇到了同样的问题
楼主是Python3.11吧

[Lv.7]特大萝卜

You're the {css} to my html.

5#
 楼主| 发表于 2022-12-3 00:07:46 | 只看该作者
爱电脑的昕宇 发表于 2022-12-2 18:58
谢谢,遇到了同样的问题
楼主是Python3.11吧

是的hhhh 之前3.10就没这个问题
Ace_qingfeng
Qingfeng_129

[Lv.7]特大萝卜

鸽子

6#
发表于 2022-12-3 10:15:24 | 只看该作者
Ace_qingfeng 发表于 2022-12-2 18:02
感谢 我这就去试下

试一下用清华的镜像源

[Lv.7]特大萝卜

You're the {css} to my html.

7#
 楼主| 发表于 2022-12-3 11:55:17 | 只看该作者
Kiring麒麟 发表于 2022-12-3 10:15
试一下用清华的镜像源

貌似不是源的问题吧 我有魔法
Ace_qingfeng
Qingfeng_129

[Lv.7]特大萝卜

8#
发表于 2022-12-3 12:58:04 | 只看该作者

联系我们(Contact)|手机版|萝卜头IT论坛 ( 苏ICP备15050961号-1 )

GMT+8, 2026-10-23 14:39 , Processed in 0.07 second(s), 20 queries , Gzip On.

快速回复 返回顶部 返回列表