AI(人工智能) TensorFlow 源码下载及编译安装
2017-05-04 14:06
363 查看
源码下载:
git clone https://github.com/tensorflow/tensorflowcd tensorflow
git checkout r1.1
切换1.1版本的代码
编译环境配置(Ubuntu14.04)
1.python :a. python 的版本是2.7 的话,如下安装:sudo apt-get install python-numpy python-dev python-pip python-wheel
b. python 的版本是3.X的话,如下安装:sudo apt-get install python3-numpy python3-dev python3-pip python3-wheel
2.python依赖:
sudo pip install six numpy wheel
3.bazel 安装:
https://github.com/bazelbuild/bazel/releases 直接下载bazel-0.4.5-installer-linux-x86_64.sh脚本,然后到下载目录执行 ./bazel-0.4.5-installer-linux-x86_64.sh即可
编译安装
进入源码目录,先执行配置文件$ ./configure
Please specify the location of python. [Default is /usr/bin/python]:
Please specify optimization flags to use during compilation when bazel option “–config=opt” is specified [Default is -march=native]:
Do you wish to use jemalloc as the malloc implementation? [Y/n] y
jemalloc enabled
Do you wish to build TensorFlow with Google Cloud Platform support? [y/N] n
No Google Cloud Platform support will be enabled for TensorFlow
Do you wish to build TensorFlow with Hadoop File System support? [y/N] n
No Hadoop File System support will be enabled for TensorFlow
Do you wish to build TensorFlow with the XLA just-in-time compiler (experimental)? [y/N] n
No XLA JIT support will be enabled for TensorFlow
Found possible Python library paths:
/usr/local/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages
Please input the desired Python library path to use. Default is [/usr/local/lib/python2.7/dist-packages]
Using python library path: /usr/local/lib/python2.7/dist-packages
Do you wish to build TensorFlow with OpenCL support? [y/N] n
No OpenCL support will be enabled for TensorFlow
Do you wish to build TensorFlow with CUDA support? [y/N] n
No CUDA support will be enabled for TensorFlow
Configuration finished
……..
INFO: Starting clean (this may take a while). Consider using –expunge_async if the clean takes more than several minutes.
……..
INFO: All external dependencies fetched successfully.
配置完之后执行如下命令编译安装
bazel build –config=opt //tensorflow/tools/pip_package:build_pip_package
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
sudo pip install /tmp/tensorflow_pkg/tensorflow-1.1.0rc0-cp27-none-linux_x86_64.whl
测试
不要在源码目录,随便找一个其他目录,执行python$python
输入如下代码:
import tensorflow as tf
hello = tf.constant(‘Hello, TensorFlow!’)
sess = tf.Session()
print(sess.run(hello))
终端打印如下语句:
Hello, TensorFlow!
perfect, 搭建完毕,现在可以开始编程了,万里长征迈出了第一步,加油!
相关文章推荐
- ubuntu10.10,下载mysql源码,编译安装
- Android 4.2源码的下载和编译环境的安装及源码的编译(跟着做能成功)
- 【转】Android 4.3源码的下载和编译环境的安装及编译
- TensorFlow非Root权限源码编译安装
- Android I9100 源码编译 Step.1----下载&安装Ubuntu系统
- 在Ubuntu上下载、编译和安装Android源码
- Ubuntu下Ruby的下载和编译源码安装
- 在Ubuntu上下载、编译和安装Android最新源码
- ubuntu 14.04LTS下源码编译安装TensorFlow0.8-No GPU
- 在Ubuntu上下载、编译和安装Android4.0.3 source与 kernel 源码
- Android 4.3源码的下载和编译环境的安装及编译
- Ubuntu下android-4.0.3_r1源码下载,阅读工具安装配置,源码编译详解
- sshd源码下载与编译安装
- Android platform 编译工具安装,源码的下载、编译
- Android_4.2_源码下载和编译环境安装及Android_4.2_源码编译
- (一)源码下载,编译,安装
- Android 源码的下载和编译环境的安装及编译
- 自动下载和安装 MNIST 到 TensorFlow 的 python 源码
- MAC OS下载源码编译安装OpenCV