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

无法安装 Pygame python 3.9.2 如何解决这个问题:

如何解决无法安装 Pygame python 3.9.2 如何解决这个问题:

我正在尝试安装 Pygame,但出现此消息:

WARNING: retrying (Retry(total=4,connect=None,read=None,redirect=None,status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org',port=443): Read timed out. (read timeout=15)")': /simple/pygame/
WARNING: retrying (Retry(total=3,port=443): Read timed out. (read timeout=15)")': /simple/pygame/
WARNING: retrying (Retry(total=2,port=443): Read timed out. (read timeout=15)")': /simple/pygame/
WARNING: retrying (Retry(total=1,port=443): Read timed out. (read timeout=15)")': /simple/pygame/
WARNING: retrying (Retry(total=0,port=443): Read timed out. (read timeout=15)")': /simple/pygame/
ERROR: Could not find a version that satisfies the requirement pygame (from versions: none)
ERROR: No matching distribution found for pygame

我使用的是 python 3.9.2

解决方法

您可能需要让 IPv4 优先于 IPv6。

如果你在 windows 上运行,请以管理员权限打开 CMD 并应用以下命令:

netsh interface ipv6 set prefixpolicy ::ffff:0:0/96 46 4

如果您在 Ubuntu 上运行(您可以轻松转换任何其他 Linux 发行版的命令):

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
,

您的消息是这样说的:

连接中断后,由 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org',port=443): Read 超时 .(阅读超时=15)”)

您可能会使用命令提示符(使用 pip)安装 pygame
但是 pip 是一个从 Pypi.org 下载模块的模块。

因此,您的计算机可能无法下载库。
此问题是由互联网访问不良引起的。

如何解决这个问题:

1. Pip 似乎无法在 Python 3.9 上正常工作,因此您应该 1. upgrade pip 2. 将 Python 降级为工作版本。

2.我这不能解决您的问题,请尝试与您的连接相关的这些想法

  • 检查您的互联网连接并重试
  • 也许您使用了代理:override
  • 可以通过在命令提示符中输入以下内容来覆盖 timed out 错误:pip --default-timeout=1000 install [PACKAGENAME]
  • 它也可能是防火墙错误,但您可以再次覆盖它like that.
,

解决方案

错误信息中最重要的部分是:

ERROR: Could not find a version that satisfies the requirement pygame (from versions: none)
ERROR: No matching distribution found for pygame

您之所以得到这个,是因为 pip 找不到与 pygame 中的 python3.9 兼容的稳定版本的 PyPi。错误消息的其余部分是超时发生这种情况是因为 pip 无限期地尝试查找匹配项,但总是为空。

这些是您的选择:

  1. 等待为 Python3.9

    添加支持
  2. 像这样安装不受支持的开发版本:

    pip install pygame==2.0..0.dev22
    

    python -3.9 -m pip install pygame
    
  3. 您可以将您的版本回滚到 ptyhon3.8 或更早版本。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。