在 windows 上安装 bazel 时出错
Error when installing bazel on windows
我正在尝试在 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"
运行 which python.exe
在你 export
新的 PATH
之后并确保结果是 /c/Users/c.kazdaghli/AppData/Local/Programs/Python/Python36/python.exe
.
请记住,which
通过在 PATH
的目录中查找文件来操作,即 PATH
必须包含 python.exe 所在目录的路径是,不是 python.exe 本身的路径。
这个问题可以通过安装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
我正在尝试在 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"
运行 which python.exe
在你 export
新的 PATH
之后并确保结果是 /c/Users/c.kazdaghli/AppData/Local/Programs/Python/Python36/python.exe
.
请记住,which
通过在 PATH
的目录中查找文件来操作,即 PATH
必须包含 python.exe 所在目录的路径是,不是 python.exe 本身的路径。
这个问题可以通过安装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