tensorflow源码安装过程
1. 安装cuda8.0和cudnn6.0(http://blog.csdn.net/disen10/article/details/79279969)
2. 安装python3
sudo apt-get install python3
安装pip3:sudo apt-get install python3-pip python3-setuptools python3-numpy cython3
修改用户默认python版本:打开~/.bashrc,添加alias python='/usr/bin/python3.4'
3. 安装bazel(https://docs.bazel.build/versions/master/install-ubuntu.html#install-on-ubuntu)
4. 安装第三放依赖库
sudo apt-get install python-numpy swig python-dev python-wheel python-setuptools
sudo apt-get install git
5. 安装tensorflow
源码下载:git clone --recursive https://github.com/tensorflow/tensorflow.git
cd tensorflow
git checkout r1.0(检查版本号)
sudo apt-get install libcupti-dev(配置环境)
sudo apt-get upgrade(升级驱动)
cd tensorflow
./configure(配置tensorflow)
bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package(build the pip package)
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg(create .whl file)
sudo pip3 install /tmp/tensorflow_pkg/(your file name).whl(install tensorflow)
6. 测试tensorflow:
cd ~
在terminal输入python3:
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))