You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows11系统Python3.10环境pip安装Pygame报错如何解决

Windows11 Python3.10 安装Pygame报错解决方法

报错核心信息:

Path for FREETYPE not found.
...Found include dir but no library dir in prebuilt-x64.
WARNING: Discarding https://files.pythonhosted.org/packages/da/b8/b10cdea95452f8f9f9e79d02062fdccaebfd808a667d6d9a805ca8d222a/pygame-1.9.2.tar.gz#sha256=2050c68ff6eba1f801efc14fd1f805aaa3a94936c80ed6725b64a75ca1bce66f (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.

该报错的根本原因是Pygame 1.9.x 版本未适配Python 3.10,pip拉取不到对应版本的预编译二进制包,自动回退到源码安装时缺少本地编译依赖导致失败

解决步骤如下:

  • 先升级本地pip工具到最新版本,执行命令:
    python -m pip install --upgrade pip
  • 直接安装适配Python 3.10的Pygame 2.0+ 稳定版本,执行命令:
    pip install pygame>=2.1.0
  • 若上述命令仍报错,可手动指定经过验证的兼容版本安装:
    pip install pygame==2.1.2
    该版本已经发布Windows平台下Python3.10对应的预编译包,无需本地编译依赖,可直接安装完成。
  • 若设备上安装了多个Python版本,可执行pip -V确认当前pip绑定的Python版本是否为3.10,避免版本错配导致的安装失败。

内容的提问来源于stack exchange,提问作者aidan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.01 10:36:05