使用Anaconda安装GPU版tensorflow1.8
为了方便跑通一些论文的代码,有时需要使用2.0版本以下的tensorflow,现将安装tensorflow1.8的步骤记录如下(已经安装过Anaconda,并更换成国内源):
打开命令行窗口
创建虚拟环境
conda create -n tf1.8 python=3.6
激活虚拟环境
conda activate tf1.8
安装cuda和cudnn(若无英伟达显卡则无须安装)
conda install cudatoolkit=9.0 cudnn=7.6.4
安装GPU版tensorflow(若无英伟达显卡则去掉命令中的-gpu,即安装CPU版)
pip install tensorflow-gpu==1.8.0
安装低版本numpy,否则import可能会报错
pip install numpy==1.14.5
测试是否安装成功
python
>>> import tensorflow as tf
>>> tf.__version__
'1.8.0'
>>> tf.test.is_gpu_available()
True