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

Python3.9+Win11环境下无法安装onnxruntime/onnxruntime-gpu求助

安装onnxruntime/onnxruntime-gpu时版本匹配错误的解决建议

问题详情

尝试通过pip安装onnxruntime和onnxruntime-gpu库时,均出现版本匹配失败的报错:

安装onnxruntime的报错信息:

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

安装onnxruntime-gpu的报错信息:

pip install onnxruntime-gpu
ERROR: Could not find a version that satisfies the requirement onnxruntime-gpu (from versions: none)
ERROR: No matching distribution found for onnxruntime-gpu

环境配置:

  • Python版本:3.9
  • 操作系统:Windows 11(已安装VSC Build Tools)
  • pip版本:23.1.2
    需求:安装上述库以满足目标检测库As-One的依赖要求

解决步骤

1. 切换pip镜像源

国内网络环境下,默认PyPI源访问可能不稳定,切换到国内镜像源尝试安装:

# 临时使用清华镜像安装onnxruntime
pip install onnxruntime -i https://pypi.tuna.tsinghua.edu.cn/simple

# 临时使用清华镜像安装onnxruntime-gpu
pip install onnxruntime-gpu -i https://pypi.tuna.tsinghua.edu.cn/simple

2. 指定具体版本安装

确认Python3.9兼容的onnxruntime版本,直接指定版本号安装(示例为1.15.1,可根据As-One依赖调整):

pip install onnxruntime==1.15.1 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install onnxruntime-gpu==1.15.1 -i https://pypi.tuna.tsinghua.edu.cn/simple

3. 确认pip归属的Python环境

避免多Python环境导致pip指向错误,先验证当前pip对应的Python版本:

python -m pip --version

确保输出显示Python版本为3.9,再用以下命令安装:

python -m pip install onnxruntime -i https://pypi.tuna.tsinghua.edu.cn/simple

4. 手动下载wheel包本地安装

如果以上方法无效,直接下载对应系统和Python版本的wheel包(.whl格式)进行本地安装:

  • 找到适配Python3.9、Windows 64位的wheel包
  • 执行本地安装命令:
pip install ./下载的wheel包文件名.whl

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.21 17:30:16