TensorFlow - 1 - Install and get start on Ubuntu 12

ccwwff發表於2017-02-05

Reference: http://www.tensorfly.cn/tfdoc/get_started/os_setup.html

https://zhuanlan.zhihu.com/p/24055668


一、簡單安裝:

$ sudo pip install tensorflow

$ python

  <<< import tensorflow as tf


二、原始碼級安裝:

1. 安裝JDK8:

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer

2. 安裝Bazel:

From: http://blog.csdn.net/idwtwt/article/details/52332640

更新bazel版本:


$ echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
$ curl https://storage.googleapis.com/bazel-apt/doc/apt-key.pub.gpg | sudo apt-key add -

sudo apt-get update && sudo apt-get install bazel

sudo apt-get upgrade bazel或者直接去下載安裝器:https://github.com/bazelbuild/bazel/releases總算可以了~


3. Download tensorflow and install other dependencies:

$ mkdir tensorflow
$ cd tensorflow
$ git clone --recurse-submodules https://github.com/tensorflow/tensorflow
$ sudo apt-get install python-numpy swig python-dev
$ ./configure


4. Compile Tensorflow: 

從原始碼樹的根路徑執行:
$ bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer
$ bazel-bin/tensorflow/cc/tutorials_example_trainer --use_gpu

$ bazel build "//tensorflow:*"


附:Bazel編譯

$ git clone https://github.com/bazelbuild/bazel.git
$ cd bazel
$ git checkout tags/0.1.0
$ ./compile.sh
$ export PATH=$PATH:"output of babel"


 

相關文章