1.下载安装bazel
$ sudo apt-get update && sudo apt-get install bazel
https://docs.bazel.build/versions/master/install-ubuntu.html
2.克隆代码
$ git clone https://github.com/tensorflow/tensorflow
如果想编译某一个版本:以1.13版本为例
$ git clone -b r1.13 https://github.com/tensorflow/tensorflow
3.使用conda虚拟环境
conda create -n avx python=3.6
conda activate avx
pip install numpy
pip install six
pip install wheel
4.编译
$ cd tensorflow
$ ./configure # 都选择N
都选N,不影响AVX,AVX2等的编译
5.bazel build
$ bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
6.生