Mac OS 安裝 Tensorflow API for C++ 且支援GPU的步驟
Step 0: (重要:必需先安裝好Cuda及Cudnn)
安裝步驟請看另一篇文章:Mac OS 安裝Cuda及Cudnn
Step 1:
brew install bazel
automake libtool
eigen
Step 2:
sudo ln -s /usr/local/Cellar/libtool/2.4.6_1/share/aclocal/* /usr/local/Cellar/
automake/1.15.1/share/aclocal-1.15
Step 3: 設定環境變數 否則會出現:
『Libtool library used but `LIBTOOL’ is undefined』
export PATH=$PATH:/usr/local/Cellar/libtool/2.4.6_1/bin
Step 4:
sudo xcode-select -s /Applications/Xcode_8.3.3/Xcode.app/Contents/Developer/sudo xcode-select -p
Step 5:
Install protobuf
git clone https://github.com/google/protobuf
./autogen.sh./configuremake check makesudo make install
Step 6:
git clone --recursive
https://github.com/tensorflow/tensorflowcd tensorflowbazel build //tensorflow:libtensorflow_cc.so
Step 7:
sudo mkdir /usr/local/include/tfsudo
cp -r bazel-genfiles/ /usr/local/include/tfsudo
cp -r tensorflow /usr/local/include/tfsudo
cp -r third_party /usr/local/include/tfsudo
cp -r bazel-bin/tensorflow/libtensorflow_cc.so /usr/local/lib