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

如何解决无法找到匹配的opencv-python==4.1.1.26版本问题

问题描述

在Anaconda虚拟环境中执行pip install -r requirements.txt安装依赖时,出现如下错误:

ERROR: Could not find a version that satisfies the requirement opencv-python4.1.1.26 (from versions: 3.4.0.14, 3.4.10.37, 3.4.11.39, 3.4.11.41, 3.4.11.43, 3.4.11.45, 3.4.13.47, 3.4.14.53, 3.4.15.55, 3.4.16.57, 3.4.16.59, 3.4.17.61, 3.4.17.63, 3.4.18.65, 4.3.0.38, 4.4.0.40, 4.4.0.42, 4.4.0.44, 4.4.0.46, 4.5.1.48, 4.5.2.54, 4.5.3.56, 4.5.4.58, 4.5.4.60, 4.5.5.62, 4.5.5.64, 4.6.0.66)
ERROR: No matching distribution found for opencv-python
4.1.1.26

环境信息:

  • Python 3.7.2
  • pip 22.2.2
  • Ubuntu 16.04
  • conda 4.5.12

requirements.txt包含的依赖:

  • opencv-python==4.1.1.26
  • lxml
  • tqdm
  • tensorflow==2.3.0
  • absl-py
  • easydict
  • matplotlib
  • pillow(注:原拼写为pillo,属于笔误)
解决方案

1. 修正requirements.txt内容

(1)替换为可用的opencv-python版本

从错误提示的可用版本列表中,选择与tensorflow==2.3.0兼容的版本,比如4.5.1.48,修改requirements.txt对应行:

opencv-python==4.5.1.48

(2)修正包名笔误

将pillo改为正确的pillow。

2. 优先通过conda安装opencv

Anaconda环境下,conda源的包适配性更好,先移除requirements.txt中的opencv-python行,执行:

conda install -c conda-forge opencv=4.1.1

如果conda源无4.1.1版本,换用相近的兼容版本(如4.1.2),再执行pip安装剩余依赖:

pip install -r requirements.txt

3. 降级pip版本尝试

高版本pip可能不再维护旧版本包的索引,降级到20.x版本后重试:

pip install pip==20.3.4
pip install -r requirements.txt

4. 手动下载whl包安装指定版本

若必须安装4.1.1.26版本,手动下载适配Python3.7+Ubuntu16.04的whl包(注意选择对应架构,如x86_64),本地安装后再处理剩余依赖:

pip install path/to/opencv_python-4.1.1.26-cp37-cp37m-linux_x86_64.whl
pip install -r requirements.txt

内容的提问来源于stack exchange,提问作者朱子鐳

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.19 07:40:34