目录
git clone https://github.com/tensorflow/tensorflow
./configure
注意,这里可以配置默认python路径
bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
这样,就在/tmp/tensorflow_pkg
生成了tensorflow-xxxx-py2-none-any.whl
参考:
进入目录:
cd tensorflow/contrib/makefile
执行文件:
sh -x ./build_all_linux.sh
cd -
注意:
必要时修改download_dependencies.sh
文件:
build_all_linux.sh
一开头就加上export PATH=~/.jumbo/bin/:$PATH
--no-check-certificate
参数,还有--secure-protocol=TLSv1.2
参数,当然如果版本不够高就升级wget。如果不好升级可以做如下改动:把
wget -P "${tempdir}" "${url}"
改成
curl -Ls "${url}" > "${tempdir}"/xxx
cd tensorflow
./configure
cd tensorflow
bazel build :libtensorflow_cc.so
产出在bazel-bin/tensorflow/libtensorflow_cc.so
tensorflow_include=./tensorflow_include
mkdir $tensorflow_include
cp -r tensorflow/contrib/makefile/downloads/eigen/Eigen $tensorflow_include/
cp -r tensorflow/contrib/makefile/downloads/eigen/unsupported $tensorflow_include/
cp -r tensorflow/contrib/makefile/gen/protobuf/include/google $tensorflow_include/
cp tensorflow/contrib/makefile/downloads/nsync/public/* $tensorflow_include/
cp -r bazel-genfiles/tensorflow $tensorflow_include/
cp -r tensorflow/cc $tensorflow_include/tensorflow
cp -r tensorflow/core $tensorflow_include/tensorflow
mkdir $tensorflow_include/third_party
cp -r third_party/eigen3 $tensorflow_include/third_party/
tensorflow_lib=./tensorflow_lib
mkdir $tensorflow_lib
cp bazel-bin/tensorflow/libtensorflow_*.so $tensorflow_lib
github地址:https://github.com/tensorflow/serving
如果要clone某个版本,可以直接
git clone -b r1.12 https://github.com/tensorflow/serving.git
如果在docker内安装:
./tools/run_in_docker.sh bazel build tensorflow_serving/model_servers:tensorflow_model_server
如果在非docker内安装:
bazel build tensorflow_serving/model_servers:tensorflow_model_server
然后我们就发现产出了这么一个bin文件:./bazel-bin/tensorflow_serving/model_servers/tensorflow_model_server
。