OpenCv编译错误-"cmd.exe" exited with code 1

本文记录了在Win7环境下使用CMake 2.8.6与Visual Studio 2010编译OpenCV 2.4.8时遇到的错误——errorMSB6006:cmd.exeexitedwithcode1,并提供了通过升级CMake版本至2.8.12.1来解决问题的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. 背景

按照网上的方法,使用CMake(版本)cmake-2.8.6 ,visual studio 2010以及Opencv 2.4.8在win7下编译;

2.现象:

出现错误——error MSB6006: "cmd.exe" exited with code 1;


提示:

3>CustomBuild:
3>  Generating opencl_kernels.cpp, opencl_kernels.hpp
3>  CMake Error at D:/software/Tool/Program/OpenCV/opencv/sources/cmake/cl2cpp.cmake:50 (string):
3>    string does not recognize sub-command MD5
3>  
3>  
3>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(151,5): error MSB6006: "cmd.exe" exited with code 1.
3>
3>Build FAILED.


3. 原因:

不清楚;


4. 解决:

使用cmake-2.8.12.1-win32-x86.exe即可解决;


D:\PyCharm2020>pip install opencv-contrib-python Collecting opencv-contrib-python Using cached opencv_contrib_python-4.11.0.86-cp37-abi3-win_amd64.whl.metadata (20 kB) Collecting numpy>=1.21.2 (from opencv-contrib-python) Using cached numpy-2.2.6.tar.gz (20.3 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... error error: subprocess-exited-with-error × Preparing metadata (pyproject.toml) did not run successfully.exit code: 1 ╰─> [21 lines of output] + D:\Matlab\Python3.14\python.exe C:\Users\dell\AppData\Local\Temp\pip-install-ukc8oxwl\numpy_87cfd92da1234f3794bab2c031a30e65\vendored-meson\meson\meson.py setup C:\Users\dell\A ppData\Local\Temp\pip-install-ukc8oxwl\numpy_87cfd92da1234f3794bab2c031a30e65 C:\Users\dell\AppData\Local\Temp\pip-install-ukc8oxwl\numpy_87cfd92da1234f3794bab2c031a30e65\.mesonpy-5221 iky5 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=C:\Users\dell\AppData\Local\Temp\pip-install-ukc8oxwl\numpy_87cfd92da1234f3794bab2c031a30e65\.mesonpy-5221iky5 \meson-python-native-file.ini The Meson build system Version: 1.5.2 Source dir: C:\Users\dell\AppData\Local\Temp\pip-install-ukc8oxwl\numpy_87cfd92da1234f3794bab2c031a30e65 Build dir: C:\Users\dell\AppData\Local\Temp\pip-install-ukc8oxwl\numpy_87cfd92da1234f3794bab2c031a30e65\.mesonpy-5221iky5 Build type: native build Project name: NumPy Project version: 2.2.6 WARNING: Failed to activate VS environment: Could not find C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe ..\meson.build:1:0: ERROR: Unknown compiler(s): [['icl'], ['cl'], ['cc'], ['gcc'], ['clang'], ['clang-cl'], ['pgcc']] The following exception(s) were encountered: Running `icl ""` gave "[WinError 2] 系统找不到指定的文件。" Running `cl /?` gave "[WinError 2] 系统找不到指定的文件。" Running `cc --version` gave "[WinError 2] 系统找不到指定的文件。"
06-08
权所有(C) Microsoft Corporation。保留所有权利。 安装最新的 PowerShell,了解新功能和改进!https://aka.ms/PSWindows (.venv1) PS D:\OCR\AW> pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Collecting altgraph==0.17.2 (from -r requirements.txt (line 1)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/84/3f/1a5c9bef54cac9bf41edd6f4aaf61cd52ed578e10ccc607e0278012cb4a5/altgraph-0.17.2-py2.py3-none-any.whl (21 kB) Collecting cycler==0.11.0 (from -r requirements.txt (line 2)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/5c/f9/695d6bedebd747e5eb0fe8fad57b72fdf25411273a39791cde838d5a8f51/cycler-0.11.0-py3-none-any.whl (6.4 kB) Collecting dlib==19.23.0 (from -r requirements.txt (line 3)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/25/0f/05e70b2ebf6a539c4c397c7c3dd19b69e0b3d650443e12a8af4866f65b03/dlib-19.23.0.tar.gz (3.2 MB) Preparing metadata (setup.py) ... done Collecting fonttools==4.33.3 (from -r requirements.txt (line 4)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/2f/85/2f6e42fb4b537b9998835410578fb1973175b81691e9a82ab6668cf64b0b/fonttools-4.33.3-py3-none-any.whl (930 kB) Collecting future==0.18.2 (from -r requirements.txt (line 5)) Using cached future-0.18.2-py3-none-any.whl Collecting importlib-metadata==4.11.4 (from -r requirements.txt (line 6)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/ab/b5/1bd220dd470b0b912fc31499e0d9c652007a60caf137995867ccc4b98cb6/importlib_metadata-4.11.4-py3-none-any.whl (18 kB) Collecting kiwisolver==1.4.2 (from -r requirements.txt (line 7)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/49/75/3a5f894ff63a2f13bd68d7962d01b9393bba139335cf9f47b2eb8739e63b/kiwisolver-1.4.2-cp39-cp39-win_amd64.whl (55 kB) Collecting matplotlib==3.5.2 (from -r requirements.txt (line 8)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/43/64/1d949d0fab5b83071290a46c93de28cbd8ff15a75b533d6c134012c61e4d/matplotlib-3.5.2-cp39-cp39-win_amd64.whl (7.2 MB) Collecting numpy==1.21.6 (from -r requirements.txt (line 9)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/4d/04/bcd62448f2e772bc90a73ba21bacaa19817ae9905ae639969462862bd071/numpy-1.21.6-cp39-cp39-win_amd64.whl (14.0 MB) Collecting opencv-python==4.5.2.54 (from -r requirements.txt (line 10)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/7c/5d/5581984f71c3378f913057beb4a0c53a22d71dd1b6d49457314ecd26c5af/opencv_python-4.5.2.54-cp39-cp39-win_amd64.whl (34.7 MB) Collecting packaging==21.3 (from -r requirements.txt (line 11)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/05/8e/8de486cbd03baba4deef4142bd643a3e7bbe954a784dc1bb17142572d127/packaging-21.3-py3-none-any.whl (40 kB) Collecting pefile==2022.5.30 (from -r requirements.txt (line 12)) Using cached pefile-2022.5.30-py3-none-any.whl Collecting Pillow==9.1.1 (from -r requirements.txt (line 13)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/cc/d9/5d0c2a0146fe68781a1920fa2a68d81bc55de38bed50beb8bf2493e0c7c1/Pillow-9.1.1-cp39-cp39-win_amd64.whl (3.3 MB) Collecting pyinstaller==5.1 (from -r requirements.txt (line 14)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/39/0c/fcedab1fc19e4a7b275c5298bb9c69e411d5092ceaf5a167b611de4c023d/pyinstaller-5.1-py3-none-win_amd64.whl (1.2 MB) Collecting pyinstaller-hooks-contrib==2022.7 (from -r requirements.txt (line 15)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/de/97/9901350320f0454a04a937666235f532353c55507679cca9712464760431/pyinstaller_hooks_contrib-2022.7-py2.py3-none-any.whl (234 kB) Collecting pyparsing==3.0.9 (from -r requirements.txt (line 16)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/6c/10/a7d0fa5baea8fe7b50f448ab742f26f52b80bfca85ac2be9d35cdd9a3246/pyparsing-3.0.9-py3-none-any.whl (98 kB) Collecting PyQt5==5.15.6 (from -r requirements.txt (line 17)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/be/f2/8e7b751d102ce3500cbeff97cb514eaf5c06d5e423676c37e9de28d0c06b/PyQt5-5.15.6-cp36-abi3-win_amd64.whl (6.7 MB) Collecting PyQt5-Qt5==5.15.2 (from -r requirements.txt (line 18)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/37/97/5d3b222b924fa2ed4c2488925155cd0b03fd5d09ee1cfcf7c553c11c9f66/PyQt5_Qt5-5.15.2-py3-none-win_amd64.whl (50.1 MB) Collecting PyQt5-sip==12.10.1 (from -r requirements.txt (line 19)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/f7/83/eecd013e3d38648e54a63ffe85639a481a14e09f4e75423968e915196937/PyQt5_sip-12.10.1-cp39-cp39-win_amd64.whl (77 kB) Collecting python-dateutil==2.8.2 (from -r requirements.txt (line 20)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/36/7a/87837f39d0296e723bb9b62bbb257d0355c7f6128853c78955f57342a56d/python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB) Collecting pywin32-ctypes==0.2.0 (from -r requirements.txt (line 21)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/9e/4b/3ab2720f1fa4b4bc924ef1932b842edf10007e4547ea8157b0b9fc78599a/pywin32_ctypes-0.2.0-py2.py3-none-any.whl (28 kB) Collecting six==1.16.0 (from -r requirements.txt (line 22)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl (11 kB) Collecting typing_extensions==4.2.0 (from -r requirements.txt (line 23)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/75/e1/932e06004039dd670c9d5e1df0cd606bf46e29a28e65d5bb28e894ea29c9/typing_extensions-4.2.0-py3-none-any.whl (24 kB) Collecting zipp==3.8.0 (from -r requirements.txt (line 24)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/80/0e/16a7ee38617aab6a624e95948d314097cc2669edae9b02ded53309941cfc/zipp-3.8.0-py3-none-any.whl (5.4 kB) Requirement already satisfied: setuptools in d:\ocr\aw\.venv1\lib\site-packages (from pyinstaller==5.1->-r requirements.txt (line 14)) (68.2.0) Building wheels for collected packages: dlib Building wheel for dlib (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully.exit code: 1 ╰─> [60 lines of output] running bdist_wheel running build running build_py running build_ext C:\Users\Admin\AppData\Local\Temp\pip-install-o09thgtz\dlib_63c12b5a1a2f485aaf617ed09e75027e\setup.py:129: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead. if LooseVersion(cmake_version) < '3.1.0': Building extension for Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] Invoking CMake setup: 'cmake C:\Users\Admin\AppData\Local\Temp\pip-install-o09thgtz\dlib_63c12b5a1a2f485aaf617ed09e75027e\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Admin\AppData\Local\Temp\pip-install-o09thgtz\d lib_63c12b5a1a2f485aaf617ed09e75027e\build\lib.win-amd64-cpython-39 -DPYTHON_EXECUTABLE=D:\OCR\AW\.venv1\Scripts\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Admin\AppData\Local\Temp\pip-install-o09thgtz\dlib_63c12b5a1a2f485aaf617ed09e75027e\build\lib.win-amd64-cpython-39 -A x64' -- Building for: Visual Studio 17 2022 CMake Error at CMakeLists.txt:2 (CMAKE_MINIMUM_REQUIRED): Compatibility with CMake < 3.5 has been removed from CMake. Update the VERSION argument <min> value. Or, use the <min>...<max> syntax to tell CMake that the project requires at least <min> but has been updated to work with policies introduced by <max> or earlier. Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway. -- Configuring incomplete, errors occurred! Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 34, in <module> File "C:\Users\Admin\AppData\Local\Temp\pip-install-o09thgtz\dlib_63c12b5a1a2f485aaf617ed09e75027e\setup.py", line 222, in <module> setup( File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\__init__.py", line 103, in setup return distutils.core.setup(**attrs) File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\_distutils\core.py", line 185, in setup return run_commands(dist) File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands dist.run_commands() File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands self.run_command(cmd) File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\dist.py", line 1001, in run_command super().run_command(command) File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command cmd_obj.run() File "D:\OCR\AW\.venv1\lib\site-packages\wheel\bdist_wheel.py", line 364, in run self.run_command("build") File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\dist.py", line 1001, in run_command super().run_command(command) File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command cmd_obj.run() File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run self.run_command(cmd_name) File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\dist.py", line 1001, in run_command super().run_command(command) File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command cmd_obj.run() File "C:\Users\Admin\AppData\Local\Temp\pip-install-o09thgtz\dlib_63c12b5a1a2f485aaf617ed09e75027e\setup.py", line 134, in run self.build_extension(ext) File "C:\Users\Admin\AppData\Local\Temp\pip-install-o09thgtz\dlib_63c12b5a1a2f485aaf617ed09e75027e\setup.py", line 171, in build_extension subprocess.check_call(cmake_setup, cwd=build_folder) File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 373, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-o09thgtz\\dlib_63c12b5a1a2f485aaf617ed09e75027e\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\Admin\\AppD ata\\Local\\Temp\\pip-install-o09thgtz\\dlib_63c12b5a1a2f485aaf617ed09e75027e\\build\\lib.win-amd64-cpython-39', '-DPYTHON_EXECUTABLE=D:\\OCR\\AW\\.venv1\\Scripts\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-o09thgtz\\dlib_63c12b5a1a2f485aaf617ed09e75027e\\build\\lib.win-amd64-cpython-39', '-A', 'x64']' returned non-zero exit status 1. [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for dlib Running setup.py clean for dlib Failed to build dlib ERROR: Could not build wheels for dlib, which is required to install pyproject.toml-based projects [notice] A new release of pip is available: 23.2.1 -> 25.1.1 [notice] To update, run: python.exe -m pip install --upgrade pip (.venv1) PS D:\OCR\AW> 怎么办
最新发布
06-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值