在使用清华大学镜像源安装 cnocr 包时,遇到以下错误:

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting cnocr==2.2.2.2
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/1e/19/e545a832e3c87a38474b1e064a8df4b34339ddec9b76694fd24fbdcf0e74/cnocr-2.2.2.2-py3-none-any.whl (204 kB)
Collecting click
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/c2/f1/df59e28c642d583f7dacffb1e0965d0e00b218e0186d7858ac5233dce840/click-8.1.3-py3-none-any.whl (96 kB)
Collecting tqdm
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/e6/02/a2cff6306177ae6bc73bc0665065de51dfb3b9db7373e122e2735faf0d97/tqdm-4.65.0-py3-none-any.whl (77 kB)

ERROR: Could not find a version that satisfies the requirement torch<2.0,>=1.8.0 (from cnocr) (from versions: 2.0.0)
ERROR: No matching distribution found for torch<2.0,>=1.8.0

错误解释:

cnocr 包依赖 torch 包,并且要求 torch 版本在 1.8.0 及以上但小于 2.0。但在指定的索引(https://pypi.tuna.tsinghua.edu.cn/simple)中,没有找到符合要求的 torch 版本。

中文翻译:

你想要安装 cnocr 包,但是 cnocr 包需要一个叫做 torch 的包,而且 torch 的版本必须在 1.8.0 以上,但又不能超过 2.0。你在使用清华大学的镜像源安装,但是镜像源里面没有找到符合要求的 torch 版本。

解决方法:

  1. 升级 torch 版本: 如果你的系统中已经安装了 torch,可以尝试升级到符合 cnocr 要求的版本。
  2. 手动安装 torch: 可以尝试手动下载符合要求的 torch 版本,然后进行安装。
  3. 更改 cnocr 版本: 如果无法满足 torch 版本要求,可以尝试使用其他版本的 cnocr 包。

建议:

在安装 Python 包时,建议使用虚拟环境来隔离不同项目的依赖关系,避免出现版本冲突。


原文地址: https://www.cveoy.top/t/topic/mu1i 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录