无法构建 opencv-contrib-python(在 Raspberry Pi 上)
Posted
技术标签:
【中文标题】无法构建 opencv-contrib-python(在 Raspberry Pi 上)【英文标题】:Failed to build opencv-contrib-python (On Rasberry Pi) 【发布时间】:2021-04-16 03:08:40 【问题描述】:我正在尝试在我的 Rasberry Pi 上安装 OpenCV,但是当我运行以下命令时,出现了一些错误。 命令:
pip install opencv-contrib-python
结果:
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting opencv-contrib-python
Using cached opencv-contrib-python-4.5.1.48.tar.gz (148.8 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Requirement already satisfied: numpy>=1.14.5 in ./.local/lib/python3.7/site-packages (from opencv-contrib-python) (1.19.5)
Building wheels for collected packages: opencv-contrib-python
Building wheel for opencv-contrib-python (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3 /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp5g982u_t
cwd: /tmp/pip-install-v1dx6hv5/opencv-contrib-python_85b21e0e2a604411afeb4dda9ea29270
Complete output (12 lines):
patching file opencv/3rdparty/openexr/IlmImf/ImfSystemSpecific.cpp
/tmp/pip-build-env-eoujog_o/overlay/lib/python3.7/site-packages/cmake/data/bin/cmake: /usr/lib/arm-linux-gnueabihf/libssl.so.1.1: version `OPENSSL_1_1_1' not found (required by /tmp/pip-build-env-eoujog_o/overlay/lib/python3.7/site-packages/cmake/data/bin/cmake)
/tmp/pip-build-env-eoujog_o/overlay/lib/python3.7/site-packages/cmake/data/bin/cmake: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.28' not found (required by /tmp/pip-build-env-eoujog_o/overlay/lib/python3.7/site-packages/cmake/data/bin/cmake)
File "/tmp/pip-build-env-eoujog_o/overlay/lib/python3.7/site-packages/skbuild/setuptools_wrap.py", line 560, in setup
cmkr = cmaker.CMaker(cmake_executable)
File "/tmp/pip-build-env-eoujog_o/overlay/lib/python3.7/site-packages/skbuild/cmaker.py", line 95, in __init__
self.cmake_version = get_cmake_version(self.cmake_executable)
File "/tmp/pip-build-env-eoujog_o/overlay/lib/python3.7/site-packages/skbuild/cmaker.py", line 82, in get_cmake_version
"Problem with the CMake installation, aborting build. CMake executable is %s" % cmake_executable)
Traceback (most recent call last):
Problem with the CMake installation, aborting build. CMake executable is cmake
----------------------------------------
ERROR: Failed building wheel for opencv-contrib-python
Failed to build opencv-contrib-python
ERROR: Could not build wheels for opencv-contrib-python which use PEP 517 and cannot be installed directly
我已经尝试了以下来源,但似乎没有任何帮助:
error-could-not-build-wheels-for-opencv-python-which-use-pep-517-and-cannot-be
Python OpenCV installation error
opencv-contrib-python
how-to-install-python-opencv-on-raspberry-pi
python3 --version
Python 3.5.3
pip3 --version
pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)
【问题讨论】:
【参考方案1】:尝试升级您的设置工具轮
pip install --upgrade pip setuptools wheel
然后重新安装opencv,
pip install opencv-contrib-python
【讨论】:
以上是关于无法构建 opencv-contrib-python(在 Raspberry Pi 上)的主要内容,如果未能解决你的问题,请参考以下文章