无法安装 opencv-contrib-python



我想在我的树莓pi4(树莓pi os(上安装opencv-contrib python

当我执行这个命令时:

sudo pip3 install opencv-contrib-python

我得到以下错误:

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting opencv-contrib-python
Using cached https://files.pythonhosted.org/packages/88/ed/87ee6dd3f3f578e1120ef38026b93aa4e78d30f0dc86f703b77bc971cd5c/opencv-contrib-python-4.5.3.56.tar.gz
Installing build dependencies ... error
Complete output from command /usr/bin/python3 -m pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-n2u745p4 --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple --extra-index-url https://www.piwheels.org/simple -- setuptools wheel scikit-build cmake pip "numpy==1.13.3; python_version=='3.6' and platform_machine != 'aarch64' and platform_machine != 'arm64'" "numpy==1.19.3; python_version>='3.6' and sys_platform == 'linux' and platform_machine == 'aarch64'" "numpy==1.21.0; python_version>='3.6' and sys_platform == 'darwin' and platform_machine == 'arm64'" "numpy==1.14.5; python_version=='3.7' and platform_machine != 'aarch64' and platform_machine != 'arm64'" "numpy==1.17.3; python_version=='3.8' and platform_machine != 'aarch64' and platform_machine != 'arm64'" "numpy==1.19.3; python_version>='3.9' and platform_machine != 'aarch64' and platform_machine != 'arm64'":
Ignoring numpy: markers 'python_version == "3.6" and platform_machine != "aarch64" and platform_machine != "arm64"' don't match your environment
Ignoring numpy: markers 'python_version >= "3.6" and sys_platform == "linux" and platform_machine == "aarch64"' don't match your environment
Ignoring numpy: markers 'python_version >= "3.6" and sys_platform == "darwin" and platform_machine == "arm64"' don't match your environment
Ignoring numpy: markers 'python_version == "3.8" and platform_machine != "aarch64" and platform_machine != "arm64"' don't match your environment
Ignoring numpy: markers 'python_version >= "3.9" and platform_machine != "aarch64" and platform_machine != "arm64"' don't match your environment
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple, https://www.piwheels.org/simple
Collecting setuptools
Using cached https://files.pythonhosted.org/packages/bd/25/5bdf7f1adeebd4e3fa76b2e2f045ae53ee208e40a4231ad0f0c3007e4353/setuptools-57.4.0-py3-none-any.whl
Collecting wheel
Using cached https://files.pythonhosted.org/packages/65/63/39d04c74222770ed1589c0eaba06c05891801219272420b40311cd60c880/wheel-0.36.2-py2.py3-none-any.whl
Collecting scikit-build
Using cached https://files.pythonhosted.org/packages/78/c9/7c2c7397ea64e36ebb292446896edcdecbb8c1aa6b9a1a32f6f67984c3df/scikit_build-0.11.1-py2.py3-none-any.whl
Collecting cmake
Using cached https://files.pythonhosted.org/packages/e1/78/66d1a7c684cb3bdd2a037b4afc0becffd7b70587e8d2b15a38f1041d2e4c/cmake-3.21.0.tar.gz
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Collecting pip
Using cached https://files.pythonhosted.org/packages/47/ca/f0d790b6e18b3a6f3bd5e80c2ee4edbb5807286c21cdd0862ca933f751dd/pip-21.1.3-py3-none-any.whl
Collecting numpy==1.14.5
Using cached https://www.piwheels.org/simple/numpy/numpy-1.14.5-cp37-cp37m-linux_armv7l.whl
Collecting distro (from scikit-build)
Using cached https://files.pythonhosted.org/packages/25/b7/b3c4270a11414cb22c6352ebc7a83aaa3712043be29daa05018fd5a5c956/distro-1.5.0-py2.py3-none-any.whl
Collecting packaging (from scikit-build)
Using cached https://files.pythonhosted.org/packages/3c/77/e2362b676dc5008d81be423070dd9577fa03be5da2ba1105811900fda546/packaging-21.0-py3-none-any.whl
Collecting pyparsing>=2.0.2 (from packaging->scikit-build)
Using cached https://files.pythonhosted.org/packages/8a/bb/488841f56197b13700afd5658fc279a2025a39e22449b7cf29864669b15d/pyparsing-2.4.7-py2.py3-none-any.whl
Building wheels for collected packages: cmake
Running setup.py bdist_wheel for cmake: started
Running setup.py bdist_wheel for cmake: finished with status 'error'
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-1h5tz_9d/cmake/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-tc247i0a --python-tag cp37:
Traceback (most recent call last):
File "/tmp/pip-build-env-u3p5rnwd/lib/python3.7/site-packages/skbuild/setuptools_wrap.py", line 560, in setup
cmkr = cmaker.CMaker(cmake_executable)
File "/tmp/pip-build-env-u3p5rnwd/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-u3p5rnwd/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)

Problem with the CMake installation, aborting build. CMake executable is cmake

----------------------------------------
Failed building wheel for cmake
Running setup.py clean for cmake
Failed to build cmake
Installing collected packages: setuptools, wheel, distro, pyparsing, packaging, scikit-build, cmake, pip, numpy
Running setup.py install for cmake: started
Running setup.py install for cmake: finished with status 'error'
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-1h5tz_9d/cmake/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-hscgf7fq/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-n2u745p4 --compile:
Traceback (most recent call last):
File "/tmp/pip-build-env-u3p5rnwd/lib/python3.7/site-packages/skbuild/setuptools_wrap.py", line 560, in setup
cmkr = cmaker.CMaker(cmake_executable)
File "/tmp/pip-build-env-u3p5rnwd/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-u3p5rnwd/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)

Problem with the CMake installation, aborting build. CMake executable is cmake

----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-1h5tz_9d/cmake/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-hscgf7fq/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-n2u745p4 --compile" failed with error code 1 in /tmp/pip-install-1h5tz_9d/cmake/

----------------------------------------
Command "/usr/bin/python3 -m pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-n2u745p4 --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple --extra-index-url https://www.piwheels.org/simple -- setuptools wheel scikit-build cmake pip "numpy==1.13.3; python_version=='3.6' and platform_machine != 'aarch64' and platform_machine != 'arm64'" "numpy==1.19.3; python_version>='3.6' and sys_platform == 'linux' and platform_machine == 'aarch64'" "numpy==1.21.0; python_version>='3.6' and sys_platform == 'darwin' and platform_machine == 'arm64'" "numpy==1.14.5; python_version=='3.7' and platform_machine != 'aarch64' and platform_machine != 'arm64'" "numpy==1.17.3; python_version=='3.8' and platform_machine != 'aarch64' and platform_machine != 'arm64'" "numpy==1.19.3; python_version>='3.9' and platform_machine != 'aarch64' and platform_machine != 'arm64'"" failed with error code 1 in None

我的python版本是:python 3.7.3

pip版本为:来自/home/pi/.local/lib/python3.7/site-packages/pip(python3.7(的pip 21.1.3

pip版本是否不一致?

我也遇到了同样的问题,原来你需要在带有apt而不是pip的RPi上安装OpenCV。这个链接帮助我在RPi4上安装了OpenCV。您需要手动安装依赖项,然后从git构建包。这有点头疼,但确实奏效了。

相关内容

  • 没有找到相关文章

最新更新