本文介绍了MSBuild:“错误MSB6006:"cmd.exe"以代码1退出."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试尝试使用CMake和MSBuild构建TensorFlow 在Windows 10上,运行MSBuild时出现以下错误:

When attempting to build TensorFlow with CMake and MSBuild on Windows 10, I get the following error when running MSBuild:

"C:\work\tensorflow\tensorflow\contrib\cmake\build\tf_tutorials_example_trainer.vcxproj" (default target) (1) ->
"C:\work\tensorflow\tensorflow\contrib\cmake\build\tf_core_gpu_kernels.vcxproj" (default target) (90) ->
(CustomBuild target) ->
  C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 1. [C:\work\tensorflow\tensorflow\contrib\cmake\build\tf_core_gpu_kernels.vcxproj]

    351 Warning(s)
    1 Error(s)

所以我只收到一条错误消息,这只是告诉我cmd.exe已关闭,并显示错误代码,表明有问题,但不是问题所在.那么,如何找出导致此问题的原因,然后解决呢?

So I only get one error message, and that just tells me that cmd.exe was closed with an error code indicating that there was a problem, but not what the problem was. So how can I find out what caused this problem so I can solve it?

推荐答案

通常会发生此错误,因为默认的cmake安装位置需要管理员权限(通常为C:/Program Files/).

This error commonly happens because the default cmake install location requires admin privileges (normally C:/Program Files/).

有两种简单的解决方法:

There are two simple ways around this:

以管理员身份运行Visual Studio覆盖CMAKE_INSTALL_PREFIX变量以指向不需要管理员特权的地方就个人而言,我建议使用第二个选项(配置cmake时,该命令将类似于:cmake.-DCMAKE_INSTALL_PREFIX = D:/Some/Path)

Run visual studio as AdministratorOverride the CMAKE_INSTALL_PREFIX variable to point somewhere not requiring admin privilegesPersonally, I'd recommend the second option (When configuring cmake, the command would be something like: cmake . -DCMAKE_INSTALL_PREFIX=D:/Some/Path)

这篇关于MSBuild:“错误MSB6006:"cmd.exe"以代码1退出."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 00:27
查看更多