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

树莓派4安装Ultralytics失败:PyTorch与TorchVision依赖冲突

树莓派4安装Ultralytics依赖冲突及PyTorch安装失败解决方法

问题场景

在树莓派4上安装Ultralytics时,遭遇PyTorch与TorchVision版本不匹配导致的依赖冲突,同时指定版本安装PyTorch时提示无匹配发行版。

报错详情

依赖冲突报错

无法安装ultralytics的8.0.85、8.0.86……8.1.9等版本,这些版本存在依赖冲突。
冲突原因:
ultralytics 8.1.27依赖torchvision>=0.9.0
ultralytics 8.1.26依赖torchvision>=0.9.0
......
ERROR: ResolutionImpossible
WARNING: 检查pip最新版本时出错

PyTorch指定版本安装报错

执行命令pip install torch==1.12.0时输出:

Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
ERROR: Could not find a version that satisfies the requirement torch==1.12.0 (from versions: none)
ERROR: No matching distribution found for torch==1.12.0
WARNING: There was an error checking the latest version of pip.

解决步骤

1. 修复PyTorch安装问题

树莓派4的ARM架构无法从PyPI获取部分旧版PyTorch,需使用piwheels提供的适配版本:

  • 安装兼容Ultralytics的最新适配版本:
    pip install torch torchvision --index-url https://www.piwheels.org/simple
    
  • 如需指定版本,先确认piwheels上的可用版本,再执行安装(示例版本):
    pip install torch==2.0.1 torchvision==0.15.2 --index-url https://www.piwheels.org/simple
    

2. 解决Ultralytics依赖冲突

  • 移除版本限制,让pip自动处理依赖:
    pip install ultralytics
    
  • 如需指定版本范围,放宽限制以避免冲突(示例安装8.1.x系列):
    pip install "ultralytics>=8.1.0,<8.2.0"
    

3. 前置优化操作

先升级pip至最新版本,避免版本检查类错误:

python -m pip install --upgrade pip

内容的提问来源于stack exchange,提问作者Abin K Jaimon

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.27 18:03:26