在windows上安装bazel时出错

在windows上安装bazel时出错,bazel,Bazel,我正在尝试在windows 7上安装Bazel版本0.10.0,但在尝试执行compile.sh时遇到问题 c.kazdghli@cKAZDGHL-STG-PC MINGW64 /c/Users/c.kazdghli/Downloads/bazel-0.10.0 $ export BAZEL_SH=c:/tools/msys64/usr/bin/bash.exe c.kazdghli@cKAZDGHL-STG-PC MINGW64 /c/Users/c.kazdghli/Downloads/b

我正在尝试在windows 7上安装Bazel版本0.10.0,但在尝试执行compile.sh时遇到问题

c.kazdghli@cKAZDGHL-STG-PC MINGW64 /c/Users/c.kazdghli/Downloads/bazel-0.10.0
$ export BAZEL_SH=c:/tools/msys64/usr/bin/bash.exe

c.kazdghli@cKAZDGHL-STG-PC MINGW64 /c/Users/c.kazdghli/Downloads/bazel-0.10.0
$ export BAZEL_VS=c:/Program\ Files\ \(x86\)/Microsoft\ visual\ studio

c.kazdghli@cKAZDGHL-STG-PC MINGW64 /c/Users/c.kazdghli/Downloads/bazel-0.10.0
$ export BAZEL_PYTHON=c:/Users/c.kazdaghli/AppData/Local/Programs/Python/Python36/python.exe

c.kazdghli@cKAZDGHL-STG-PC MINGW64 /c/Users/c.kazdghli/Downloads/bazel-0.10.0
$ ./compile.sh
ERROR: cannot locate python.exe; check your PATH.
       You may need to run the following command, or something
       similar, depending on where you installed Python:
         export PATH="/c/Python27:$PATH"

c.kazdghli@cKAZDGHL-STG-PC MINGW64 /c/Users/c.kazdghli/Downloads/bazel-0.10.0
$ export PATH=/c/Users/c.kazdaghli/AppData/Local/Programs/Python/Python36:$PATH

c.kazdghli@cKAZDGHL-STG-PC MINGW64 /c/Users/c.kazdghli/Downloads/bazel-0.10.0
$ ./compile.sh
ERROR: cannot locate python.exe; check your PATH.
       You may need to run the following command, or something
       similar, depending on where you installed Python:
         export PATH="/c/Python27:$PATH"
导出新路径后运行哪个python.exe,并确保结果为/c/Users/c.kazdaghli/AppData/Local/Programs/python/Python36/python.exe


请记住,它是通过在路径的目录中查找文件来操作的,即路径必须包含python.exe所在目录的路径,而不是python.exe本身的路径。

通过从Chocolate安装bazel可以轻松解决此问题

使用cmd.exe安装Chocolate:

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
然后在cmd中使用以下命令安装bazel:

choco install bazel --pre
$which python.exe which:no python.exe在/c/Users/c.kazdaghli/AppData/Local/Programs/Python36/python.exe:/mingw64/bin:/usr/Local/bin:/usr/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/windowpowershell/v1.0/在那里:/c/Users/../Python36/python.exe-那里有python.exe,实际上,这应该只是一个目录。也许您运行了导出路径=/c/Users/../Python36/python.exe:$PATH,而不是导出路径=/c/Users/../Python36:$PATH?c。kazdghli@cKAZDGHL-STG-PC MINGW64~$export PATH=/c/Users/c.kazdaghli/AppData/Local/Programs/Python/Python36:$PATH c。kazdghli@cKAZDGHL-STG-PC MINGW64~$which python.exe which:中没有python.exe/c/Users/c.kazdaghli/AppData/Local/Programs/Python36:/c/Users/c.kazdaghli/AppData/Local/Programs/Python36:/c/Users/c.kazdaghli/AppData/Local/Programs/Python36/Python.exe:/mingw64/bin:/usr/Local/bin:/usr/bin:/c/Windows/System32/Wbem:/c/Windows/System32/windowshell/v1.0/