TensorFlow1.4+CUDA8.0+OPENCV3.2+CuDNN5.1安装

摘抄自https://www.tensorflow.org/install/install_sources

其实没必要写本文的,安装比caffe简单多了。


Installing Bazel on Ubuntu

1. Install JDK 8

Install JDK 8 by using:

sudo apt-get install openjdk-8-jdk

2. Add Bazel distribution URI as a package source (one time setup)

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 -

3. Install and update Bazel

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

Once installed, you can upgrade to a newer version of Bazel with:

sudo apt-get upgrade bazel


Install python dependencies

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

Optional: install TensorFlow for GPU prerequisites

sudo apt-get install libcupti-dev 

Clone the TensorFlow repository

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


Build the pip package

To build a pip package for TensorFlow with CPU-only support,you would typically invoke the following command:

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

To build a pip package for TensorFlow with GPU support,invoke the following command:

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

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

Install the pip package


sudo pip install /tmp/tensorflow_pkg/tensorflow-1.4.0-cp27-cp27mu-linux_x86_64.whl

Validate your installation

Change directory (cd) to any directory on your system other than thetensorflow subdirectory from which you invoked the configure command.

Invoke python:

$ python

Enter the following short program inside the python interactive shell:

# Python
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

If the system outputs the following, then you are ready to begin writingTensorFlow programs:

Hello, TensorFlow!


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值