ubuntu14 编译tensorflow C++ 接口

tensorflow1.11

bazel 0.15.2

protobuf 3.6.0

eigen 3.3.5

wget -t 0 -c https://github.com/eigenteam/eigen-git-mirror/archive/3.3.5.zip
unzip 3.3.5.zip
cd eigen-git-mirror-3.3.5/
mkdir build
cd build
cmake ..
make
sudo make install

编译tensorflow  

./configure

我需要的是CPU环境调用 所以一路都是NO

有显卡的执行 sudo bazel build --config=opt --config=cuda //tensorflow:libtensorflow_cc.so
没有显卡的执行 sudo bazel build --config=opt //tensorflow:libtensorflow_cc.so

编译成功以后复制一些头文件

mkdir /usr/local/include/tf

cp -r bazel-genfiles/ /usr/local/include/tf/

cp -r tensorflow /usr/local/include/tf/

cp -r third_party /usr/local/include/tf/

cp bazel-bin/tensorflow/libtensorflow_cc.so /usr/local/lib/

cp bazel-bin/tensorflow/libtensorflow_framework.so /usr/local/lib

参考链接

Tensorflow C++ 从训练到部署(1):环境搭建

 

    原文作者:tensorflow
    原文地址: https://www.cnblogs.com/cnugis/p/11506383.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞