天天看点

安装成功 Win10系统 TensorFlow python3.5 VS2015 CUDA8.0 Cuddn 5.1

TF 安装

安装 VS 2015

iso VS2015下载并按点击安装即可

Cuda8.0

https://developer.nvidia.com/cuda-80-ga2-download-archive

安装成功 Win10系统 TensorFlow python3.5 VS2015 CUDA8.0 Cuddn 5.1
安装成功 Win10系统 TensorFlow python3.5 VS2015 CUDA8.0 Cuddn 5.1

cuDNN v5.1

https://developer.nvidia.com/rdp/cudnn-archive

cuda 安装解压缩后 文件目录

将文件夹保存 另外一个地方

安装成功 Win10系统 TensorFlow python3.5 VS2015 CUDA8.0 Cuddn 5.1
安装成功 Win10系统 TensorFlow python3.5 VS2015 CUDA8.0 Cuddn 5.1
安装成功 Win10系统 TensorFlow python3.5 VS2015 CUDA8.0 Cuddn 5.1
安装成功 Win10系统 TensorFlow python3.5 VS2015 CUDA8.0 Cuddn 5.1

Copy  刚才存储的文件

安装成功 Win10系统 TensorFlow python3.5 VS2015 CUDA8.0 Cuddn 5.1

分别输入deviceQuery.exe 和 bandwidthTest.exe,运行结果如图所示。Rsult=PASS则说明通过

安装成功 Win10系统 TensorFlow python3.5 VS2015 CUDA8.0 Cuddn 5.1
安装成功 Win10系统 TensorFlow python3.5 VS2015 CUDA8.0 Cuddn 5.1

Copy 文件

安装成功 Win10系统 TensorFlow python3.5 VS2015 CUDA8.0 Cuddn 5.1

在路径 c:\ProgramFiles (x86)\Microsoft Visual Studio 14.0\Common7\IDE下,打开cmd(管理员身份): “devenv /setup”

安装成功 Win10系统 TensorFlow python3.5 VS2015 CUDA8.0 Cuddn 5.1
安装成功 Win10系统 TensorFlow python3.5 VS2015 CUDA8.0 Cuddn 5.1
安装成功 Win10系统 TensorFlow python3.5 VS2015 CUDA8.0 Cuddn 5.1

CUDA8.0 安装完成

Copy cuddn5.1

安装成功 Win10系统 TensorFlow python3.5 VS2015 CUDA8.0 Cuddn 5.1

打开Anaconda Prompt,进入Anaconda命令行管理界面。配置清华仓库镜,输入指令:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

conda config --set show_channel_urls yes

创建运行环境,输入指令:

conda create -n tensorflow-gpu python=3.5

新建一个名字叫“tensorflow-gpu”,python版本为3.5的运行环境,此环境与Anaconda中其它环境隔离。红框中的软件包也会随之安装,输入“y“和回车后开始安装。

激活并进入环境,使后续指令在激活的环境中生效,输入指令:

conda activate tensorflow-gpu

升级pip到最新版,防止稍后的安装时,出现错误(笔者初次在安装tensorflow时,没有更新pip到最新版,导致下载到一半出现错误),输入指令:

python -m pip install --upgrade pip

  1. 在tensorflow环境下,使用pip安装CPU版TensorFlow,执行命令

pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.1.0-cp35-cp35m-win_amd64.whl

  1. 在tensorflow环境下,使用pip安装GPU版TensorFlow,执行命令

pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.1.0-cp35-cp35m-win_amd64.whl

TF1.1.0

安装成功 Win10系统 TensorFlow python3.5 VS2015 CUDA8.0 Cuddn 5.1
安装成功 Win10系统 TensorFlow python3.5 VS2015 CUDA8.0 Cuddn 5.1
安装成功 Win10系统 TensorFlow python3.5 VS2015 CUDA8.0 Cuddn 5.1

latest version

Python 3.5 CPU-only https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.12.0-cp35-cp35m-win_amd64.whl
Python 3.5 GPU support https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.12.0-cp35-cp35m-win_amd64.whl
  1. 打开 anaconda prompt
  2. 执行activate tensorflow-gpu
  1. 打开python,执行python
  1. 执行以下代码

import tensorflow as tf

hello = tf.constant('Hello, TensorFlow!')

sess = tf.Session()

print(sess.run(hello))

安装成功 Win10系统 TensorFlow python3.5 VS2015 CUDA8.0 Cuddn 5.1
tf

继续阅读