在Windows上安装bazel时出错

时间:2018-04-17 09:32:26

标签: 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/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"

2 个答案:

答案 0 :(得分:0)

$('.k-state-selected').removeClass('k-state-selected k-state-selecting'); which python.exe之后运行export,并确保结果为PATH

请记住,/c/Users/c.kazdaghli/AppData/Local/Programs/Python/Python36/python.exe通过查找which目录中的文件来操作,即PATH必须包含python.exe所在目录的路径,而不是python.exe本身的路径。

答案 1 :(得分:-1)

通过安装Chocolatey的bazel可以轻松解决这个问题

使用cmd.exe安装Chocolatey:

@"%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