先决条件:openjdk1.8 ,openjdk-devel1.8
1. 操作系统需求
centos7
2. 资源库下载
https://docs.bazel.build/versions/master/install-redhat.html
参见以上链接,下载repo文件并复制到 /etc/yum.repos.d/.
3. 安装
yum install bazel
可能会存在镜像连接超时的情况,这时候可以多几次或者尝试科学上网
完成后,bazel是无法识别命令的。此时bazel安装在/usr/bin 下面
在/etc/profile中天剑环境变量:
export BAZEL_HOME=/usr/bin
export PATH =$PATH:$BAZEL_HOME
注意不要写成,会无法识别
export BAZEL_HOME=/usr/bin/
然后再次运行 bazel命令:
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".
[bazel release 0.19.2- (@non-git)]
Usage: bazel <command> <options> ...
Available commands:
analyze-profile Analyzes build profile data.
aquery Analyzes the given targets and queries the action graph.
build Builds the specified targets.
canonicalize-flags Canonicalizes a list of bazel options.
clean Removes output files and optionally stops the server.
coverage Generates code coverage report for specified test targets.
cquery Loads, analyzes, and queries the specified targets w/ configurations.
dump Dumps the internal state of the bazel server process.
fetch Fetches external repositories that are prerequisites to the targets.
help Prints help for commands, or the index.
info Displays runtime info about the bazel server.
license Prints the license of this software.
mobile-install Installs targets to mobile devices.
print_action Prints the command line args for compiling a file.
query Executes a dependency graph query.
run Runs the specified target.
shutdown Stops the bazel server.
sync Syncs all repositories specifed in the workspace file
test Builds and runs the specified test targets.
version Prints version information for bazel.
Getting more help:
bazel help <command>
Prints help and options for <command>.
bazel help startup_options
Options for the JVM hosting bazel.
bazel help target-syntax
Explains the syntax for specifying targets.
bazel help info-keys
Displays a list of keys used by the info command.
此时bazel已经安装成功,可以看到版本.
tensorflow 要求bazel的版本是0.5+
注意: bazel 运行需要 openjdk1.8 ,openjdk-devel1.8