Ubuntu:从源码安装tensorflow r1.0 - Install TensorFlow r1.0 from Sources
2017-03-21 13:17
561 查看
本文记录如何从源码安装tensorflow10CPU版本Python 27
安装依赖bazelTensorflow Python dependencies
1Bazel
2Tensorflow Python dependencies
安装tensorflow
1Clone the TensorFlow repository
Configure the installation
3Build the pip package
4Install the pip package
Validate your installation
官方链接:install tensorflow from sources
1.install JDK 8 :
我电脑已经有了jdk,所以跳过这一步,验证:
![](https://img-blog.csdn.net/20170321124103615?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvb3Vrb2hvdQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
2.install bazel:
然后会是一连串选择,官方示例如下:
根据自己需要选择就好了。
这一步会比较耗内存,如果对电脑没信心的话,可以加上“–local_resources 2048,.5,1.0 while invoking bazel”:
之后会是漫长的等待,我的电脑足足跑了1个小时,不过我们离成功已经很近了,加油!再输入:
这一步会生成 .whl文件,聪明的你肯定知道这就是黎明前的曙光了,没错,接下来,我们:
比如我的文件名是-“tensorflow-1.0.1-cp27-cp27mu-linux_x86_64.whl”,所以就输入:
OK,now check it out.
![](https://img-blog.csdn.net/20170321131031869?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvb3Vrb2hvdQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
以上,幸会。
个人github链接:oukohou的git ,后续会迁移一些东西,暂时比较空。
个人微信公共号:oukohou
![](https://img-blog.csdn.net/20170321131314426?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvb3Vrb2hvdQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
hello there.
Scan and we will see.
安装依赖bazelTensorflow Python dependencies
1Bazel
2Tensorflow Python dependencies
安装tensorflow
1Clone the TensorFlow repository
Configure the installation
3Build the pip package
4Install the pip package
Validate your installation
官方链接:install tensorflow from sources
本文记录如何从源码安装tensorflow1.0,CPU版本,Python 2.7:
1. 安装依赖:bazel,Tensorflow Python dependencies
1)Bazel:
官方链接:install bazel on Ubuntu1.install JDK 8 :
$ sudo add-apt-repository ppa:webupd8team/java $ sudo apt-get update $ sudo apt-get install oracle-java8-installer
我电脑已经有了jdk,所以跳过这一步,验证:
2.install 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://bazel.build/bazel-release.pub.gpg | sudo apt-key add - $ sudo apt-get update && sudo apt-get install bazel $ sudo apt-get upgrade bazel
2)Tensorflow Python dependencies:
包括:numpy,dev,pip,wheel$ sudo apt-get install python-numpy python-dev python-pip python-wheel
2. 安装tensorflow:
1)Clone the TensorFlow repository:
这里用到git,如需安装,参见install git$ git clone https://github.com/tensorflow/tensorflow $ cd tensorflow $ git checkout r1.0
2.Configure the installation
还是在刚刚的文件夹目录下,命令行输入:$ cd tensorflow # cd to the top-level directory created $ ./configure
然后会是一连串选择,官方示例如下:
Please specify the location of python. [Default is /usr/bin/python]: /usr/bin/python2.7 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] jemalloc enabled Do you wish to build TensorFlow with Google Cloud Platform support? [y/N] No Google Cloud Platform support will be enabled for TensorFlow Do you wish to build TensorFlow with Hadoop File System support? [y/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] 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] Y CUDA support will be enabled for TensorFlow Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]: Please specify the Cuda SDK version you want to use, e.g. 7.0. [Leave empty to use system default]: 8.0 Please specify the location where CUDA 8.0 toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: Please specify the cuDNN version you want to use. [Leave empty to use system default]: 5 Please specify the location where cuDNN 5 library is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: Please specify a list of comma-separated Cuda compute capabilities you want to build with. You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus. Please note that each additional compute capability significantly increases your build time and binary size. [Default is: "3.5,5.2"]: 3.0 Setting up Cuda include Setting up Cuda lib Setting up Cuda bin Setting up Cuda nvvm Setting up CUPTI include Setting up CUPTI lib64 Configuration finished
根据自己需要选择就好了。
3)Build the pip package
命令号运行:$ bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
这一步会比较耗内存,如果对电脑没信心的话,可以加上“–local_resources 2048,.5,1.0 while invoking bazel”:
$ bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package --local_resources 2048,.5,1.0 while invoking bazel
之后会是漫长的等待,我的电脑足足跑了1个小时,不过我们离成功已经很近了,加油!再输入:
$ bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
这一步会生成 .whl文件,聪明的你肯定知道这就是黎明前的曙光了,没错,接下来,我们:
4)Install the pip package
你的 .whi 文件会在“/tmp/tensorflow_pkg”目录下,没错,找到它,然后输入:$ sudo pip install /tmp/tensorflow_pkg/name-of-you-whl.whl
比如我的文件名是-“tensorflow-1.0.1-cp27-cp27mu-linux_x86_64.whl”,所以就输入:
$ sudo pip install /tmp/tensorflow_pkg/ tensorflow-1.0.1-cp27-cp27mu-linux_x86_64.whl
OK,now check it out.
3.Validate your installation
以上,幸会。
个人github链接:oukohou的git ,后续会迁移一些东西,暂时比较空。
个人微信公共号:oukohou
hello there.
Scan and we will see.
相关文章推荐
- ubuntu14.04 安装tensorflow+opencv
- ubuntu14.04+cuda8.0+cudnn5.1+caffe+tensorflow 安装教程(三)
- ubuntu下的tensorflow安装:cuda8.0+cudnn5.0+opencv2.4.11+anaconda+tensorflow
- ubuntu安装cuda8.0+tensorflow+pytorch
- 双显卡 ubuntu16.04 安装 NVIDIA驱动 + CUDA + cuDNN + tensorflow-gpu + keras
- Ubuntu16.04安装CUDA7.5+Caffe+tensorflow
- Ubuntu Windows双系统安装 anaconda tensorflow安装
- ubuntu上安装keras + tensorflow
- 雅虎开源TensorflowOnSpark,Ubuntu配置安装TensorflowOnSpark
- Anaconda+tensorflow1.0安装
- ubuntu14.04+GTX960+cuda8.0+cudnn5.1+Theano+Tensorflow安装教程
- 雅虎开源TensorflowOnSpark,Ubuntu配置安装TensorflowOnSpark
- Ubuntu安装Pyenv+Anaconda2+PyCharm+OpenAI-gym+Cuda+TensorFlow (二)
- ubuntu14.04 安装TensorFlow&升级 cuda8.0 的坑
- Install tensorflow/SyntaxNet on Ubuntu VM
- ubuntu14.04+cuda8.0+cudnn5.1+caffe+tensorflow 安装教程(一)
- Ubuntu安装Pyenv+Anaconda2+PyCharm+OpenAI-gym+Cuda+TensorFlow (四)
- ubuntu16.04 64位 cpu安装tensorflow+theano+keras+caffe+xgboost
- Ubuntu16.04下安装tensorflow(Anaconda3+pycharm+tensorflow+CPU)
- Ubuntu16.04下安装Cuda8.0+Caffe+TensorFlow-gpu+Pycharm过程(Simple)