您的位置:首页 > 运维架构

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

2017-12-29 05:14 260 查看

摘抄自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 the
tensorflow
subdirectory from which you invoked the
configure
command.
Invoke python:$ pythonEnter 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!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: