有时候我们需要源码安装tensorflow,这时逃不过的第一步就是安装Bazel,如果没有root权限的时候,这时我们就需要源码安装Bazel了。
4. 更新bashrc
export PATH=$PATH:**/output/bazel
下面是安装步骤,参考:https://docs.bazel.build/versions/master/install-compile-source.html
1. Ensure that JDK 8, Python, Bash, zip, and the usual C++ build toolchain are installed on your system.
这里需要说明的是JDK8的安装,一般centos默认安装了openJDK,但不完整,因此我们改用oracle的java版本,具体安装方法,见:《 安装oracle-java,并覆盖原先的OpenJDK》
2. Download and unpack Bazel's distribution archive.
Download bazel-<version>-dist.zip
from the release page:https://github.com/bazelbuild/bazel/releases
3. Build Bazel using ./compile.sh
.
cd
into the directory where you unpacked the distribution archive- run
bash ./compile.sh
output/bazel下面。
4. 更新bashrc
export PATH=$PATH:**/output/bazel
然后source ~/.bashrc即可。