在mac m1芯片 上使用 bazel 遇到问题:
ERROR: The project you’re trying to build requires Bazel 3.1.0 (specified in /Users/libra/Projects/tensorflow/.bazelversion), but it wasn’t found in /opt/homebrew/Cellar/bazel/5.0.0/libexec/bin.
Bazel binaries for all official releases can be downloaded from here:
https://github.com/bazelbuild/bazel/releases
You can download the required version directly using this command:
(cd “/opt/homebrew/Cellar/bazel/5.0.0/libexec/bin” && curl -fLO https://releases.bazel.build/3.1.0/release/bazel-3.1.0-darwin-arm64 && chmod +x bazel-3.1.0-darwin-arm64)
按照提示:下载 bazel-3.1.0-darwin-arm64
然后会报404,因为bazel-3.1.0 没有编译darwin-arm64版本:
此时直接 修改 命令 下载x86版本
(cd "/opt/homebrew/Cellar/bazel/5.0.0/libexec/bin" && curl -fL -o bazel-3.1.0 https://releases.bazel.build/3.1.0/release/bazel-3.1.0-darwin-x86_64 && chmod +x bazel-3.1.0
注意 不要使用默认文件名 bazel-3.1.0-darwin-x86_64
如果遇到 提示可执行文件架构不支持,需执行shell:softwareupdate --install-rosetta
安装 rosetta