【cmake编译】编译失败:could not find any instance of Visual Studio

编译失败:could not find any instance of Visual Studio

用bat脚本对c++进行编译
编译报错

Visual Studio 16 2019
could not find any instance of Visual Studio

网上找了很多方案,都无法解决我的问题

解决方案如下:

  1. 打开visual studio 2019或者打开visual studio installer
    如果打开的是visual studio 2019, 选择获取工具和功能, 同样会打开visual studio installer

在这里插入图片描述
选择使用c++的桌面开发
在这里插入图片描述
搞了半天,原来cmake调用的是这个

再次执行bat脚本,cmake编译成功

PS C:\Users\shang\AppData\Local\Temp\unified_server(2).py1787532444930598> pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Collecting opencv-python Using cached https://pypi.tuna.tsinghua.edu.cn/packages/17/06/68c27a523103dad5837dc5b87e71285280c4f098c60e4fe8a8db6486ab09/opencv-python-4.11.0.86.tar.gz (95.2 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Installing backend dependencies ... done Preparing metadata (pyproject.toml) ... done Requirement already satisfied: numpy>=1.13.3 in d:\programdata\anaconda3\lib\site-packages (from opencv-python) (1.19.4) Building wheels for collected packages: opencv-python Building wheel for opencv-python (pyproject.toml) ... error ERROR: Command errored out with exit status 1: command: 'D:\ProgramData\Anaconda3\python.exe' 'D:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' build_wheel 'C:\Users\shang\AppData\Local\Temp\tmpt37wunkv' cwd: C:\Users\shang\AppData\Local\Temp\pip-install-_e4wuhw5\opencv-python_1977012de0b84efa86f25c93f367b4ae Complete output (395 lines): -------------------------------------------------------------------------------- -- Trying 'Ninja (Visual Studio 17 2022 x64 v143)' generator -------------------------------- --------------------------- ---------------------- ----------------- ------------ ------- -- Not searching for unused variables given on the command line. CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument <min> value or use a ...<max> suffix to tell CMake that the project does not need compatibility with older versions. CMake Error at CMakeLists.txt:2 (PROJECT): Generator Ninja does not support platform specification, but platform x64 was specified. -- Configuring incomplete, errors occurred! -- ------- ------------ ----------------- ---------------------- --------------------------- -------------------------------- -- Trying 'Ninja (Visual Studio 17 2022 x64 v143)' generator - failure -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Trying 'Visual Studio 17 2022 x64 v143' generator -------------------------------- --------------------------- ---------------------- ----------------- ------------ ------- -- Not searching for unused variables given on the command line. CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument <min> value or use a ...<max> suffix to tell CMake that the project does not need compatibility with older versions. CMake Error at CMakeLists.txt:2 (PROJECT): Generator Visual Studio 17 2022 could not find any instance of Visual Studio. -- Configuring incomplete, errors occurred! -- ------- ------------ ----------------- ---------------------- --------------------------- -------------------------------- -- Trying 'Visual Studio 17 2022 x64 v143' generator - failure -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Trying 'Ninja (Visual Studio 16 2019 x64 v142)' generator -------------------------------- --------------------------- ---------------------- ----------------- ------------ ------- -- Not searching for unused variables given on the command line. CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument <min> value or use a ...<max> suffix to tell CMake that the project does not need compatibility with older versions. CMake Error at CMakeLists.txt:2 (PROJECT): Generator Ninja does not support platform specification, but platform x64 was specified. -- Configuring incomplete, errors occurred! -- ------- ------------ ----------------- ---------------------- --------------------------- -------------------------------- -- Trying 'Ninja (Visual Studio 16 2019 x64 v142)' generator - failure -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Trying 'Visual Studio 16 2019 x64 v142' generator -------------------------------- --------------------------- ---------------------- ----------------- ------------ ------- -- Not searching for unused variables given on the command line. CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument <min> value or use a ...<max> suffix to tell CMake that the project does not need compatibility with older versions. CMake Error at CMakeLists.txt:2 (PROJECT): Generator Visual Studio 16 2019 could not find any instance of Visual Studio. -- Configuring incomplete, errors occurred! -- ------- ------------ ----------------- ---------------------- --------------------------- -------------------------------- -- Trying 'Visual Studio 16 2019 x64 v142' generator - failure -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Trying 'Ninja (Visual Studio 15 2017 x64 v141)' generator -------------------------------- --------------------------- ---------------------- ----------------- ------------ ------- -- Not searching for unused variables given on the command line. CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument <min> value or use a ...<max> suffix to tell CMake that the project does not need compatibility with older versions. CMake Error at CMakeLists.txt:2 (PROJECT): Generator Ninja does not support platform specification, but platform x64 was specified. -- Configuring incomplete, errors occurred! -- ------- ------------ ----------------- ---------------------- --------------------------- -------------------------------- -- Trying 'Ninja (Visual Studio 15 2017 x64 v141)' generator - failure -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Trying 'Visual Studio 15 2017 x64 v141' generator -------------------------------- --------------------------- ---------------------- ----------------- ------------ ------- -- Not searching for unused variables given on the command line. CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument <min> value or use a ...<max> suffix to tell CMake that the project does not need compatibility with older versions. CMake Error at CMakeLists.txt:2 (PROJECT): Generator Visual Studio 15 2017 could not find any instance of Visual Studio. -- Configuring incomplete, errors occurred! -- ------- ------------ ----------------- ---------------------- --------------------------- -------------------------------- -- Trying 'Visual Studio 15 2017 x64 v141' generator - failure -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Trying 'NMake Makefiles (Visual Studio 17 2022 x64 v143)' generator -------------------------------- --------------------------- ---------------------- ----------------- ------------ ------- -- Not searching for unused variables given on the command line. CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument <min> value or use a ...<max> suffix to tell CMake that the project does not need compatibility with older versions. CMake Error at CMakeLists.txt:2 (PROJECT): Generator NMake Makefiles does not support platform specification, but platform x64 was specified. -- Configuring incomplete, errors occurred! -- ------- ------------ ----------------- ---------------------- --------------------------- -------------------------------- -- Trying 'NMake Makefiles (Visual Studio 17 2022 x64 v143)' generator - failure -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Trying 'NMake Makefiles (Visual Studio 16 2019 x64 v142)' generator -------------------------------- --------------------------- ---------------------- ----------------- ------------ ------- -- Not searching for unused variables given on the command line. CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument <min> value or use a ...<max> suffix to tell CMake that the project does not need compatibility with older versions. CMake Error at CMakeLists.txt:2 (PROJECT): Generator NMake Makefiles does not support platform specification, but platform x64 was specified. -- Configuring incomplete, errors occurred! -- ------- ------------ ----------------- ---------------------- --------------------------- -------------------------------- -- Trying 'NMake Makefiles (Visual Studio 16 2019 x64 v142)' generator - failure -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Trying 'NMake Makefiles (Visual Studio 15 2017 x64 v141)' generator -------------------------------- --------------------------- ---------------------- ----------------- ------------ ------- -- Not searching for unused variables given on the command line. CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument <min> value or use a ...<max> suffix to tell CMake that the project does not need compatibility with older versions. CMake Error at CMakeLists.txt:2 (PROJECT): Generator NMake Makefiles does not support platform specification, but platform x64 was specified. -- Configuring incomplete, errors occurred! -- ------- ------------ ----------------- ---------------------- --------------------------- -------------------------------- -- Trying 'NMake Makefiles (Visual Studio 15 2017 x64 v141)' generator - failure -------------------------------------------------------------------------------- ******************************************************************************** scikit-build could not get a working generator for your system. Aborting build. Building windows wheels for Python 3.6 requires Microsoft Visual Studio 2022. Get it with "Visual Studio 2017": https://visualstudio.microsoft.com/vs/ Or with "Visual Studio 2019": https://visualstudio.microsoft.com/vs/ Or with "Visual Studio 2022": https://visualstudio.microsoft.com/vs/ ******************************************************************************** ---------------------------------------- ERROR: Failed building wheel for opencv-python Failed to build opencv-python ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-based projects
最新发布
05-31
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值