Search code examples
bazel

Error when installing bazel on windows


I am trying to install Bazel (version 0.10.0) on windows 7, but i have a problem when i try to excute 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"

Solution

  • This problem can be easily solved by the installing bazel from Chocolatey

    Install Chocolatey with cmd.exe:

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

    Then use the following command in cmd to install bazel:

    choco install bazel --pre