我无法安装 Pygame Zero 或 Pygame 库

我无法安装 Pygame Zero 或 Pygame 库

我使用的是 Windows 10,Python 版本为 3.9.2。我尝试使用以下命令pip install pygame
pip install pgzero

我在命令提示符下收到以下消息:

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)'))': /simple/pygame/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)'))': /simple/pygame/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)'))': /simple/pygame/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)'))': /simple/pygame/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)'))': /simple/pygame/
Could not fetch URL https://pypi.org/simple/pygame/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pygame/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)'))) - skipping
ERROR: Could not find a version that satisfies the requirement pygame (from versions: none)
ERROR: No matching distribution found for pygame
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)'))) - skipping

答案1

您是否尝试过手动下载 wheel 文件并使用 pip 安装?虽然这不能解决根本问题,但目前可能已经足够了。

  1. https://pypi.org/project/pygame/#files并找到您需要的版本,根据您的描述,cp3.9 应该是“pygame-2.0.1-cp39-cp39-win_amd64.whl”。
  2. 打开 Powershell 或 cmd,导航到您的下载文件夹并运行pip install pygame-2.0.1-cp39-cp39-win_amd64.whl或其他适当的版本。

这对我来说没问题。你可以对其他包执行相同操作,只需找到其 pypi 页面即可。

答案2

如果你的“pip”已经过期,并且你安装的包在当前版本的“pip”中不存在,就会发生这种情况

尝试在命令提示符中输入以下内容:

python -m pip 安装--升级pip

但它还说“pip”无法验证 SSL 证书,所以如果您已经更新了“pip”但它不起作用,那么请尝试更新 openssl。

老实说,我不知道如何在 Windows 上做到这一点,但如果你只更新“pip”,这个问题更有可能得到解决

相关内容