python - 无法为python安装pygame

标签 python pygame anaconda command-prompt

今天早上,我尝试在 Windows 命令提示符下安装 pygame,但出现如下错误:

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\Users\User>pip install pygame
Collecting pygame
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))
 after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFI
CATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certif
icate (_ssl.c:1045)'))': /simple/pygame/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None))
 after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFI
CATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certif
icate (_ssl.c:1045)'))': /simple/pygame/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None))
 after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFI
CATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certif
icate (_ssl.c:1045)'))': /simple/pygame/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None))
 after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFI
CATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certif
icate (_ssl.c:1045)'))': /simple/pygame/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None))
 after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFI
CATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certif
icate (_ssl.c:1045)'))': /simple/pygame/
  Could not fetch URL https://pypi.org/simple/pygame/: There was a problem confi
rming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max r
etries exceeded with url: /simple/pygame/ (Caused by SSLError(SSLCertVerificatio
nError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to
 get local issuer certificate (_ssl.c:1045)'))) - skipping
  Could not find a version that satisfies the requirement pygame (from versions:
 )
No matching distribution found for pygame

C:\Users\User>

所以我尝试运行 anaconda 来安装 pygame,但我得到了另一个错误。

(base) C:\Users\User>conda install -c cogsci pygame
Solving environment: failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pk
gs/pro/win-64/repodata.json.bz2>
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.


If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.

SSLError(MaxRetryError('HTTPSConnectionPool(host=\'repo.anaconda.com\', port=443
): Max retries exceeded with url: /pkgs/pro/win-64/repodata.json.bz2 (Caused by
SSLError(SSLError("bad handshake: Error([(\'SSL routines\', \'ssl3_get_server_ce
rtificate\', \'certificate verify failed\')])")))'))



(base) C:\Users\User>

我无法理解错误。之前命令可以运行,但现在不起作用。我以为是连接错误,但我可以顺利运行任何网站。我该怎么办?

最佳答案

可以通过访问 pygame.org 在 Windows 上安装 PyGame并下载 .MSI 安装程序。这不依赖于 pipanaconda

您收到的问题似乎是 SSL 证书问题,与 PyGame 无关。您的两种安装方法都存在与 SSL 相同的问题。

关于python - 无法为python安装pygame,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53165777/

相关文章:

python - 为什么 numba 不优化代码中调用的子例程?

python - 在协程中使用全局状态变量?

python - uWSGI虚拟主机问题

python - 对 glPerspective 和 GL_POLYGON 的困惑

python - Pygame 类型错误 : __init__ takes exactly 4 arguments (1 given)

python - 为什么我的带有平铺 map 的 pygame 游戏滞后?

Python请求和beautifulsoup4,仅收集 "href"链接

windows - Anaconda Navigator 无法启动,download_api 错误(Windows 10)

python - 通过 conda 安装软件包时,奇怪的重复序列打印到控制台

python-3.x - 使用@rpath/libpoppler.71.dylib 找不到图像