【问题标题】:`Building wheel for opencv-python (PEP 517) ... -` runs forever`opencv-python(PEP 517)的构建轮...... -`永远运行
【发布时间】:2020-12-19 12:15:43
【问题描述】:

当我跑步时

!pip install imgaug==0.4.0

以下是输出

Collecting imgaug==0.4.0
  Using cached https://files.pythonhosted.org/packages/66/b1/af3142c4a85cba6da9f4ebb5ff4e21e2616309552caca5e8acefe9840622/imgaug-0.4.0-py2.py3-none-any.whl
Requirement already satisfied: Pillow in /opt/conda/envs/Python-3.6/lib/python3.6/site-packages (from imgaug==0.4.0) (5.4.1)
Requirement already satisfied: numpy>=1.15 in /opt/conda/envs/Python-3.6/lib/python3.6/site-packages (from imgaug==0.4.0) (1.15.4)
Collecting Shapely (from imgaug==0.4.0)
  Using cached https://files.pythonhosted.org/packages/9d/18/557d4f55453fe00f59807b111cc7b39ce53594e13ada88e16738fb4ff7fb/Shapely-1.7.1-cp36-cp36m-manylinux1_x86_64.whl
Requirement already satisfied: six in /opt/conda/envs/Python-3.6/lib/python3.6/site-packages (from imgaug==0.4.0) (1.12.0)
Requirement already satisfied: matplotlib in /opt/conda/envs/Python-3.6/lib/python3.6/site-packages (from imgaug==0.4.0) (3.0.2)
Collecting scikit-image>=0.14.2 (from imgaug==0.4.0)
  Using cached https://files.pythonhosted.org/packages/0e/ba/53e1bfbdfd0f94514d71502e3acea494a8b4b57c457adbc333ef386485da/scikit_image-0.17.2-cp36-cp36m-manylinux1_x86_64.whl
Requirement already satisfied: imageio in /opt/conda/envs/Python-3.6/lib/python3.6/site-packages (from imgaug==0.4.0) (2.4.1)
Collecting opencv-python (from imgaug==0.4.0)
  Using cached https://files.pythonhosted.org/packages/77/f5/49f034f8d109efcf9b7e98fbc051878b83b2f02a1c73f92bbd37f317288e/opencv-python-4.4.0.42.tar.gz
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: scipy in /opt/conda/envs/Python-3.6/lib/python3.6/site-packages (from imgaug==0.4.0) (1.2.0)
Requirement already satisfied: cycler>=0.10 in /opt/conda/envs/Python-3.6/lib/python3.6/site-packages (from matplotlib->imgaug==0.4.0) (0.10.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /opt/conda/envs/Python-3.6/lib/python3.6/site-packages (from matplotlib->imgaug==0.4.0) (1.0.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /opt/conda/envs/Python-3.6/lib/python3.6/site-packages (from matplotlib->imgaug==0.4.0) (2.3.1)
Requirement already satisfied: python-dateutil>=2.1 in /opt/conda/envs/Python-3.6/lib/python3.6/site-packages (from matplotlib->imgaug==0.4.0) (2.7.5)
Collecting tifffile>=2019.7.26 (from scikit-image>=0.14.2->imgaug==0.4.0)
  Using cached https://files.pythonhosted.org/packages/3c/13/4f873f6b167c2e77288ce8db1c9f742d1e0e1463644e2df4e3bd3c40a422/tifffile-2020.8.25-py3-none-any.whl
Requirement already satisfied: networkx>=2.0 in /opt/conda/envs/Python-3.6/lib/python3.6/site-packages (from scikit-image>=0.14.2->imgaug==0.4.0) (2.2)
Collecting PyWavelets>=1.1.1 (from scikit-image>=0.14.2->imgaug==0.4.0)
  Using cached https://files.pythonhosted.org/packages/59/bb/d2b85265ec9fa3c1922210c9393d4cdf7075cc87cce6fe671d7455f80fbc/PyWavelets-1.1.1-cp36-cp36m-manylinux1_x86_64.whl
Requirement already satisfied: setuptools in /opt/conda/envs/Python-3.6/lib/python3.6/site-packages (from kiwisolver>=1.0.1->matplotlib->imgaug==0.4.0) (40.8.0)
Requirement already satisfied: decorator>=4.3.0 in /opt/conda/envs/Python-3.6/lib/python3.6/site-packages (from networkx>=2.0->scikit-image>=0.14.2->imgaug==0.4.0) (4.3.2)
Building wheels for collected packages: opencv-python
  Building wheel for opencv-python (PEP 517) ... -

但是Building wheel for opencv-python (PEP 517) ... - 永远运行,如何解决这个问题?

【问题讨论】:

  • 什么机器,你对“永远”的定义是什么?
  • 这发生在我的“pip install opencv-python”中,最新版本好像是opencv-python-4.4.0.44
  • 它不会永远运行。 OpenCV 是一个非常繁重的 C++ 库,即使在现代 CPU 上,从源代码编译它通常也需要 10 多分钟。您可以通过将 pip 升级到支持现代 manylinux2014 预建轮子的版本来避免这种情况:pip install --upgrade pip
  • 去喝杯咖啡吧,我的i5-4210U @ 1.70GHz6GB 花了大约 20 分钟

标签: python python-3.x opencv-python


【解决方案1】:

首先使用显式安装 openCV-Python 来解决 !pip install opencv-python==4.2.0.34 在运行之前!pip install imgaug 由于老版本的opencv-python不需要轮子编译。

【讨论】:

  • 新版本也不需要编译。你只需要在安装opencv-python之前升级你的pippip install --upgrade pip
【解决方案2】:

尝试使用旧版本的 python。比如python3.7

【讨论】:

    【解决方案3】:

    我遇到了同样的问题,一切都解决了:

    pip install --upgrade pip setuptools wheel
    

    【讨论】:

    • 也许在pip install --upgrade pip setuptools wheel 之后运行pip install --upgrade pip 也是一个好习惯;解决任何冲突。我都做了,问题解决了。
    【解决方案4】:

    我在下载pip install opencv-python时也遇到了这种情况 只需转到首选项,转到python解释器,然后检查轮子包并通过单击它并按添加标记旁边的减号将其删除。出现此错误是因为要下载它,该软件包应首先为车轮构建数千个依赖项,因为 opencv 是一个大软件包。如果您卸载轮子,则它们不必构建依赖项。 请注意,卸载轮子不会影响代码中的任何内容。我有一台 mac 并使用 pycharm 作为 IDE,所以我不确定它是否适用于其他设备。

    这是卸载轮子后解释器的图像

    【讨论】:

      猜你喜欢
      • 2021-02-04
      • 1970-01-01
      • 2020-12-23
      • 2020-12-31
      • 1970-01-01
      • 2021-01-30
      • 2021-03-07
      • 2023-01-16
      • 2020-11-01
      相关资源
      最近更新 更多