Ubuntu:从源码安装tensorflow r1.0
来源:互联网 发布:设备吞吐量测试软件 编辑:程序博客网 时间:2024/05/17 22:30
- 本文记录如何从源码安装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
本文记录如何从源码安装tensorflow1.0,CPU版本,Python 2.7:
1. 安装依赖:bazel,Tensorflow Python dependencies
1)Bazel:
官方链接:install bazel on Ubuntu
1.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.7Please 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 enabledDo you wish to build TensorFlow with Google Cloud Platform support? [y/N]No Google Cloud Platform support will be enabled for TensorFlowDo you wish to build TensorFlow with Hadoop File System support? [y/N]No Hadoop File System support will be enabled for TensorFlowDo you wish to build TensorFlow with the XLA just-in-time compiler (experimental)? [y/N]No XLA JIT support will be enabled for TensorFlowFound possible Python library paths: /usr/local/lib/python2.7/dist-packages /usr/lib/python2.7/dist-packagesPlease 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-packagesDo you wish to build TensorFlow with OpenCL support? [y/N] NNo OpenCL support will be enabled for TensorFlowDo you wish to build TensorFlow with CUDA support? [y/N] YCUDA support will be enabled for TensorFlowPlease 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.0Please 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]: 5Please 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.0Setting up Cuda includeSetting up Cuda libSetting up Cuda binSetting up Cuda nvvmSetting up CUPTI includeSetting up CUPTI lib64Configuration 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.
1 0
- Ubuntu:从源码安装tensorflow r1.0
- TensorFlow r1.4 从源码编译安装
- ubuntu16.04 从源码安装tensorflow-gpu r1.4版本---2017-12-07
- ubuntu源码安装tensorflow
- tensorflow API r1.0
- Jeston tx1 安装tensorflow r0.9 r1.0
- TensorFlow安装入门从Ubuntu到Windows
- Ubuntu 源码编译安装 GPU版 TensorFlow
- Ubuntu 16.04 Tensorflow 使用源码安装
- Ubuntu Apache从源码安装
- 【Tensorflow】Tensorflow 1.2.0 源码安装
- 从安装Ubuntu一直到TensorFlow的安装
- 在64位ubuntu上安装tensorflow 以及源码安装
- tensorflow安装(非源码安装,ubuntu 14.04 LTS)
- 从源码编译TensorFlow
- 从源码编译TensorFlow
- 在linux(centos)上从源码安装tensorflow
- ubuntu14.04 LTS下从源码安装TensorFlow
- 学习博客 有微信项目
- netcat 瑞士军刀
- OSAL系统框架专题
- 2017入职规划
- 4.2 对Direct3D进行初始化
- Ubuntu:从源码安装tensorflow r1.0
- 在MogoDB shell中插入int取出编程Double
- eclipse 下载走过的坑
- 九度OJ-题目1169:比较奇偶数个数-10计院上机A
- VS2010中编译openssl的步骤和使用设置
- web项目导入eclipse出错解决
- PythonPi基于人脸检测的行车控制-PythonPi的目标驱动型控制
- mysql语句执行效率定位
- P2P、P2C 、O2O 、B2C、B2B、 C2C是什么