解决 Could not find a version that satisfies the requirement xxx

在 Ubuntu 22 下为 python 2.7 安装 numpy、opencv 时的报错记录

电脑上的 Ubuntu 版本是 22.04.1,因为工作需要用到 python2,而 Python 2 已经从 ubuntu20.04 中移除了,于是手动安装了 python 2.7.18;又手动下载了 pip,版本是 20.3.4

从 https://www.python.org/downloads/ 下载的 python 安装之后是有带pip安装包的,安装目录下/lib/python2.7/ensurepip/_bundled/ 下面有 pip-19.2.3-py2.py3-none-any.whl,pip install xxxx.whl可以安装对应安装包,不过没有试过当前环境下这样安装能不能用

不知道是不是因为这一顿操作导致版本不匹配还是怎样,使用 pip install numpy命令时会提示:

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

此时使用命令 pip -vvv install numpy可以安装numpy,安装下来的版本为1.16.6

Successfully installed numpy-1.16.6

使用 pip install opencv命令时会提示:

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

此时使用命令 pip install opencv-python==3.2.0.8可以安装

(4.2.0.32是最新一个可支持python2.7的版本。可以根据需要安装对应的opencv版本)

Original: https://blog.csdn.net/qq_42764416/article/details/126117314
Author: Dead_John
Title: 解决 Could not find a version that satisfies the requirement xxx

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/757020/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球