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

Python包安装故障求助:安装cowsay时遭遇连接重置错误

解决pip安装cowsay时的ConnectionResetError(10054)问题

你遇到的是pip连接PyPI官方源时被远程主机强制关闭连接的错误,错误日志如下:

Obtaining dependency information for cowsay from https://files.pythonhosted.org/packages/f1/13/63c0a02c44024ee16f664e0b36eefeb22d54e93531630bd99e237986f534/cowsay-6.1-py3-none-any.whl.metadata
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /packages/f1/13/63c0a02c44024ee16f664e0b36eefeb22d54e93531630bd99e237986f534/cowsay-6.1-py3-none-any.whl.metadata
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /packages/f1/13/63c0a02c44024ee16f664e0b36eefeb22d54e93531630bd99e237986f534/cowsay-6.1-py3-none-any.whl.metadata
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /packages/f1/13/63c0a02c44024ee16f664e0b36eefeb22d54e93531630bd99e237986f534/cowsay-6.1-py3-none-any.whl.metadata
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /packages/f1/13/63c0a02c44024ee16f664e0b36eefeb22d54e93531630bd99e237986f534/cowsay-6.1-py3-none-any.whl.metadata
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /packages/f1/13/63c0a02c44024ee16f664e0b36eefeb22d54e93531630bd99e237986f534/cowsay-6.1-py3-none-any.whl.metadata
ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/f1/13/63c0a02c44024ee16f664e0b36eefeb22d54e93531630bd99e237986f534/cowsay-6.1-py3-none-any.whl.metadata (Caused by ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)))

以下是可行的解决方法:

  • 切换国内PyPI镜像源:国内访问官方源稳定性差,使用国内镜像能快速解决问题,执行命令:

    pip install cowsay -i https://pypi.tuna.tsinghua.edu.cn/simple
    

    也可以配置永久使用镜像源,避免每次输入:

    pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
    
  • 检查网络与安全软件:重启路由器恢复网络连接;暂时关闭防火墙、杀毒软件或代理工具,这些程序可能拦截了pip的网络请求。

  • 手动下载包安装:直接下载对应版本的cowsay包到本地,再执行本地安装:

    1. 下载cowsay-6.1-py3-none-any.whl文件
    2. 执行本地安装命令:
    pip install /path/to/cowsay-6.1-py3-none-any.whl
    

    (将/path/to/替换为实际文件路径)

  • 更新pip版本:旧版pip可能存在网络兼容问题,先升级pip再尝试安装:

    pip install --upgrade pip
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.20 04:47:11