天天看點

源碼安裝tensorflow源碼安裝tensorflow

源碼安裝tensorflow

下載下傳tensorflow:

git clone https://github.com/tensorflow/tensorflow

安裝python依賴庫:

sudo apt-get install python-numpy python-dev python-pip python-wheel

如果是安裝tensorflow for python3,則為:

 sudo apt-get install python3-numpy python3-dev python3-pip python3-wheel

要實作GPU計算,還需要安裝cuda,cudnn,安裝步驟可參考:http://blog.csdn.net/u011961856/article/details/76723285

安裝libcupti-dev:

sudo apt-get install libcupti-dev 

安裝bazel:

https://docs.bazel.build/versions/master/install.html

進入tensorflow目錄

cd tensorflow

運作configure:

./configure

編譯pip 安裝包:

cpu:

sudo bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package

gpu

sudo bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package 

生成pip安裝包,.whl檔案:

sudo bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg

進入目錄/tmp/tensorflow_pkg,并檢視生成的.whl檔案:

cd /tmp/tensorflow_pkg

ls

查詢發現生成的安裝包名為:

tensorflow-1.3.0rc1-cp27-cp27mu-linux_x86_64.whl

pip安裝tensorflow for python2:

sudo pip2 install tensorflow-1.3.0rc1-cp27-cp27mu-linux_x86_64.whl

pip安裝tensorflow for python3:

sudo pip3 install tensorflow-1.3.0rc1-cp27-cp27mu-linux_x86_64.whl

測試是否安裝成功:

import tensorflow成功,說明安裝成功.

--------------------- 

作者:imperfect00 

來源:CSDN 

原文:

https://blog.csdn.net/u011961856/article/details/76725411

版權聲明:本文為部落客原創文章,轉載請附上博文連結!