初始化环境
sudo apt-get update sudo apt-get upgrade sudo apt-get install -y build-essential git python-pip libfreetype6-dev libxft-dev libncurses-dev libopenblas-dev gfortran python-matplotlib libblas-dev liblapack-dev libatlas-base-dev python-dev python-pydot linux-headers-generic linux-image-extra-virtual unzip python-numpy swig python-pandas python-sklearn unzip wget pkg-config zip g++ zlib1g-dev
下载 cuda [注:tensorflow-gpu当前pip安装版本1.9,支持cuda9.0+cudnn7.1.4for cuda9.0
http://developer.download.nvidia.com/compute/cuda/repos/ 选择对应系统版本,本次使用cuda9sudo dpkg -i cuda-repo-ubuntu1410_XXXX_amd64.deb rm cuda-repo-ubuntu1410_XXXX_amd64.deb sudo apt-get update sudo apt-get install -y cuda 安装错误卸载 sudo dpkg -P packagename, sudo apt-get autoremove cuda
下载cudnn
https://developer.nvidia.com/rdp/cudnn-archive 选择 cuDNN vXXX Library for Linux,目前下载cudnn7.1.4 for cuda9.0 cp cudnn-XXX.solitairetheme8 cudnn-linux-x64.tgz tar -xvf cudnn-linux-x64.tgz sudo cp cuda/include/cudnn.h /usr/local/cuda/include sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64 sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
配置环境变量
sudo vi ~/.bashrcexport LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"export CUDA_HOME=/usr/local/cudaexport PATH="$CUDA_HOME/bin:$PATH"source ~/.bashrc
安装tensorflow-gpu == 1.9
pip install keras pip install tensorflow-gpu==1.9
安装运行
import tensorflow as tf
作者:加拿大女孩
链接:https://www.jianshu.com/p/317373a8dac9
点击查看更多内容
为 TA 点赞
评论
共同学习,写下你的评论
评论加载中...
作者其他优质文章
正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦