为什么 Bazel 找不到 Visual C++ 构建工具?

boo*_*kin 4 c++ windows visual-c++ bazel

我正在自己完成 Tensorflow 安装会话(每个会话都是一次独特的体验),并且我试图了解 Bazel 构建工具出了什么问题。

为此,我在下载了指南中提到的所有内容后按照此处的示例进行操作。我还适当添加了环境变量:

尝试构建一个示例后,我得到:

The target you are compiling requires Visual C++ build tools.
Bazel couldn't find a valid Visual C++ build tools installation on your machine.

Visual C++ build tools seems to be installed at C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC
But Bazel can't find the following tools:
    VCVARSALL.BAT, cl.exe, link.exe, lib.exe, ml64.exe
Run Code Online (Sandbox Code Playgroud)

这是没有意义的。我检查了这个目录中可以找到cl.exe、link.exe和ml64.exe。我的另一个怀疑是我可能需要管理员权限,所以我也使用管理员权限运行构建,但这没有什么区别。

我怀疑 VCVARSALL.bat 可能丢失,但我不知道需要安装什么才能获取该文件。

小智 5

转至开始菜单 > 设置。

\n

找到设置 \xe2\x80\x9c编辑帐户的环境变量\xe2\x80\x9d

\n

查看顶部的列表(\xe2\x80\x9c\xe2\x80\x9d 的用户变量),然后单击其下方的 \xe2\x80\x9cNew\xe2\x80\xa6\xe2\x80\x9d 按钮。

\n

对于 \xe2\x80\x9c 变量名称\xe2\x80\x9d,输入 BAZEL_VC

\n

单击\xe2\x80\x9c浏览目录\xe2\x80\xa6\xe2\x80\x9d

\n

导航到 Visual Studio 的 VC 目录。

\n

例如,这可能是系统上的 C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC。

\n

选择VC文件夹并单击确定

\n

\xe2\x80\x9cVariable value\xe2\x80\x9d 字段现在具有 VC 的路径。单击“确定”关闭窗口。

\n

完毕。

\n

如果您现在打开一个新的 cmd.exe 或 PowerShell 终端并运行 Bazel,它将找到 Visual C++。

\n

\xe6\x82\xa8\xe5\xa5\xbd\xef\xbc\x8c\xe8\xbf\x99\xe4\xb8\xaa\xe6\x98\xaf\xe5\xae\x98\xe7\xbd\x91\xe7 \x9a\x84\xe8\xbf\x9e\xe6\x8e\xa5https://docs.bazel.build/versions/main/install-windows.html

\n

\xe5\xa5\xbd\xe5\x83\x8f\xe5\xb0\xb1\xe6\x98\xaf\xe8\xaf\xb4\nset BAZEL_VS=C:\\Program Files (x86)\\Microsoft Visual Studio\\ 2019\\BuildTools\nset BAZEL_VC=C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\n\xe8\xbf\x99\xe4\xb8\xa4\xe8\xa1\ x8c\xe4\xbb\xa3\xe7\xa0\x81\xe6\xb2\xa1\xe6\x9c\x89\xe6\x95\x88\xe6\x9e\x9c\xef\xbc\x8c\xe8\x99\xbd\ xe7\x84\xb6\xe8\xbf\x90\xe8\xa1\x8c\xe6\xb2\xa1\xe6\x9c\x89\xe9\x94\x99\xe8\xaf\xaf\xef\xbc\x8c\xe4\ xbd\x86\xe6\x98\xaf\xe5\xb9\xb6\xe6\xb2\xa1\xe6\x9c\x89\xe8\xb5\xb7\xe5\x88\xb0\xe6\x95\x88\xe6\x9e\ x9c\n\xe8\xbf\x98\xe6\x98\xaf\xe8\xa6\x81\xe7\x94\xa8\xe5\x8e\x9f\xe5\xa7\x8b\xe7\x9a\x84\xe6\x96\ xb9\xe6\xb3\x95\xef\xbc\x8c\xe5\x9c\xa8\xe6\x88\x91\xe7\x9a\x84\xe7\x94\xb5\xe8\x84\x91\xe9\x87\x8c\ xe9\x9d\xa2->\xe9\xab\x98\xe7\xba\xa7\xe7\xb3\xbb\xe7\xbb\x9f\xe8\xae\xbe\xe7\xbd\xae->\xe7\x8e\ xaf\xe5\xa2\x83\xe5\x8f\x98\xe9\x87\x8f->\xe7\x94\xa8\xe6\x88\xb7\xe5\x8f\x98\xe9\x87\x8f\xef\xbc\ x9b\xe8\x87\xaa\xe5\xb7\xb1\xe6\x89\x8b\xe5\x8a\xa8\xe5\x88\x9b\xe5\xbb\xbaBAZEL_VS\xe5\x92\x8cBAZEL_VC\xe8\xbf\x99\ xe4\xb8\xa4\xe4\xb8\xaa\xe5\x8f\x98\xe9\x87\x8f

\n