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

如何解决安装torch时出现的“No matching distribution found for typing-extensions”错误?

问题与解决方案

问题场景

从HTTP下载torch的whl文件后,执行以下安装命令:

pip install "D:\CUDA\torch-1.12.0+cu113-cp39-cp39-win_amd64.whl"

出现SSL证书验证失败错误,最终无法获取typing-extensions依赖,报错信息如下:

Looking in indexes: https://pypi.org/simple/
Processing d:\cuda\torch-1.12.0+cu113-cp39-cp39-win_amd64.whl
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: self-signed certificate in certificate chain (_ssl.c:1129)'))': /simple/typing-extensions/
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: self-signed certificate in certificate chain (_ssl.c:1129)'))': /simple/typing-extensions/
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: self-signed certificate in certificate chain (_ssl.c:1129)'))': /simple/typing-extensions/
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: self-signed certificate in certificate chain (_ssl.c:1129)'))': /simple/typing-extensions/
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: self-signed certificate in certificate chain (_ssl.c:1129)'))': /simple/typing-extensions/
Could not fetch URL https://pypi.org/simple/typing-extensions/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/typing-extensions/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1129)'))) - skipping
INFO: pip is looking at multiple versions of torch to determine which version is compatible with other requirements. This could take a while.
ERROR: Could not find a version that satisfies the requirement typing-extensions (from torch) (from versions: none)
ERROR: No matching distribution found for typing-extensions

环境信息

  • NVIDIA GPU:RTX A4000
  • CUDA版本:11.3(通过nvcc -V验证)
  • 已准备的whl文件:
    • torch:1.12.0+cu113(torch-1.12.0+cu113-cp39-cp39-win_amd64.whl)
    • torchvision:0.13.0+cu113(torchvision-0.13.0+cu113-cp39-cp39-win_amd64.whl)
    • torchaudio:0.12.0+cu113(torchaudio-0.12.0+cu113-cp39-cp39-win_amd64.whl)

解决方案

方法1:跳过SSL验证安装

执行安装命令时添加信任主机参数,绕过SSL证书验证:

pip install "D:\CUDA\torch-1.12.0+cu113-cp39-cp39-win_amd64.whl" --trusted-host pypi.org --trusted-host files.pythonhosted.org

方法2:手动下载依赖离线安装

  1. 下载适配Python3.9、Windows AMD64架构的typing-extensions whl文件。
  2. 先安装依赖:
pip install "本地路径\typing_extensions-对应版本-cp39-none-win_amd64.whl"
  1. 再安装torch:
pip install "D:\CUDA\torch-1.12.0+cu113-cp39-cp39-win_amd64.whl"

方法3:使用国内镜像源

替换pip源为国内镜像,避免SSL问题:

pip install "D:\CUDA\torch-1.12.0+cu113-cp39-cp39-win_amd64.whl" -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.07 19:50:34