Ubuntu 16.04 安装 TensorFlow(GPU支持)
2017-05-02 16:17
609 查看
Ubuntu 16.04 安装 TensorFlow(GPU支持)
http://www.linuxidc.com/Linux/2017-04/143115.htm本文记录Ubuntu 16.04安装Tensorflow步骤,也包括怎么从源码编译安装Tensorflow。
要想安装Tensorflow GPU版本,你需要有一个新一点的Nvidia显卡。
Tensorflow CPU版本的安装
1 2 | $sudo apt-getinstall python-pip python-dev python-virtualenv # python 2.7 $sudo apt-getinstall python3-pip python3-dev python3-virtualenv# python 3.4+ |
1 2 | $virtualenv--system-site-packages~/tensorflow $source~/tensorflow/bin/activate |
1 2 3 4 5 6 7 8 | # Ubuntu/Linux 64-bit, CPU only, Python 2.7 $export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0rc1-cp27-none-linux_x86_64.whl # Ubuntu/Linux 64-bit, CPU only, Python 3.4 $export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0rc1-cp34-cp34m-linux_x86_64.whl # Ubuntu/Linux 64-bit, CPU only, Python 3.5 $export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0rc1-cp35-cp35m-linux_x86_64.whl |
1 2 3 4 5 | # Python 2 $sudo pip install--upgrade$TF_BINARY_URL # Python 3 $sudo pip3 install--upgrade$TF_BINARY_URL |
编译安装Tensorflow(GPU支持)
安装NVidia显卡驱动,你可以在Ubuntu内置的附加驱动中安装。1 2 | $sudo add-apt-repository ppa:graphics-drivers/ppa $sudo apt update |
1 2 3 4 5 6 | #下载安装: #https://developer.nvidia.com/cuda-toolkit $sudo shcuda_8.0.44_linux.run--override # 安装位置: /usr/local/cuda # 默认仓库中的版本较旧 #$ sudo apt install nvidia-cuda-toolkit nvidia-cuda-dev # 安装位置: /usr |
1 2 3 4 5 | # 下载CudNN 5.1 for Cuda 8.0 $sudo tar-xzvf cudnn-8.0-linux-x64-v5.1.tgz $sudo cp cuda/include/cudnn.h/usr/local/cuda/include $sudo cp cuda/lib64/libcudnn*/usr/local/cuda/lib64 $sudo chmoda+r/usr/local/cuda/include/cudnn.h/usr/local/cuda/lib64/libcudnn* |
1 2 | export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64" export CUDA_HOME=/usr/local/cuda |
1 | $source~/.bashrc |
1 2 | $cd~ $git clonehttps://github.com/tensorflow/tensorflow |
1 | $sudo apt-getinstall default-jdk python-dev python3-dev python-numpy python3-numpy build-essential python-pip python3-pip python-virtualenv swig python-wheel libcurl3-dev |
1 2 3 4 5 | $echo"deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8"|sudo tee/etc/apt/sources.list.d/bazel.list $curl https://storage.googleapis.com/bazel-apt/doc/apt-key.pub.gpg|sudo apt-key add- $sudo apt-getupdate $sudo apt-getinstall bazel $sudo apt-getupgrade bazel |
1 2 | $cd~/tensorflow $./configure |
输入Python模块路径,默认是/usr/local/lib/python2.7/dist-packages。如果你使用Python3,输入:/usr/local/lib/python3.5/dist-packages。
输入Cuda SDK版本和Cudnn版本:8.0、5.1.5。
配置完成,输入如下信息:
1 2 | INFO:All external dependencies fetched successfully. Configuration finished |
1 2 3 | $bazel build-copt--config=cuda # GPU支持 # CPU支持 #$ bazel build -c opt |
1 | $bazel-bin/tensorflow/tools/pip_package/build_pip_package/tmp/tensorflow_pkg |
1 2 | $sudo pip install/tmp/tensorflow_pkg/tensorflow # python2 $sudo pip3 install/tmp/tensorflow_pkg/tensorflow # python3 |
https://www.tensorflow.org/versions/r0.11/get_started/os_setup.html#download-and-setup tensorflow源代码:https://github.com/tensorflow/tensorflow
本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-04/143115.htm
相关文章推荐
- Ubuntu 16.04 安装 Tensorflow(GPU支持)
- 【转】Ubuntu 16.04安装配置TensorFlow GPU版本
- [置顶] Ubuntu16.04下安装tensorflow并配置GPU
- [置顶] Ubuntu 16.04最简单的tensorflow-gpu安装教程
- Ubuntu16.04下安装配置了tensorflow GPU版本后导致的常见错误
- Ubuntu 16.04 + CUDA 8.0 + cuDNN v5.1 + TensorFlow(GPU support)安装配置详解
- ubuntu16.04下安装TensorFlow(GPU加速)
- ubuntu 16.04 安装Tensorflow(CPU和GPU)
- Ubuntu16.04安装tensorflow-gpu版
- Ubuntu16.04+cuda-8.0+cudnn-v5.1+tensorflow0.8-gpu/tensorflow1.0-gpu安装教程
- tensorflow:ubuntu16.04 gpu版本安装
- Ubuntu 16.04下安装Tensorflow(GPU)
- ubuntu16.04下安装CUDA,cuDNN及tensorflow-gpu版本过程
- Ubuntu16.04+Anaconda 安装GPU版本tensorflow
- ubuntu16.04下安装TensorFlow(GPU加速)----详细图文教程
- Theano、Lasagne、TensorFlow在Ubuntu14.04 64支持GPU的安装 py27
- ubuntu 16.04 安装TensorFlow GPU版本
- ubuntu16.04下安装TensorFlow(GPU加速)----详细图文教程
- Ubuntu16.04版本搭建Tensorflow环境并启用GPU支持
- 小米笔记本2 Ubuntu 16.04下安装Tensorflow GPU 1.2.1版本说明