Windows下安装tensorflow步骤--更ok

来源:互联网 发布:java new string 编辑:程序博客网 时间:2024/05/29 18:17

转载于

http://blog.csdn.net/chongtong/article/details/53905625?locationNum=6&fps=1


记住:python安装好了后,是在cmd命令下操作,安装


官方安装链接 
tensorflow 0.12.0开始支持Windows下安装了

环境要求:

  • Windows 64位
  • python 3.5
  • pip 9.0.1
  • tensorflow 0.12.0
  • cuda8.0
  • cudnn5.1
  • visual c++ 2015 运行时库 
    查看gpu是否支持cuda

安装过程:

安装python3.5

  • 下载
  • 安装
  • 升级pip
python.exe -m pip install --upgrade pip
  • 1

安装tensorflow

  • gpu版本
pip install --upgrade tensorflow-gpu
  • 1
  • cpu版本
pip install --upgrade tensorflow
  • 1

gpu版本tensorflow安装gpu支持包

安装cuda8.0

  • 下载
  • 安装

安装cudnn5.1

  • 下载
  • 安装
添加解压后的bin目录到PATH环境变量
  • 1

测试tensorflow

$ python...>>> import tensorflow as tf>>> hello = tf.constant('Hello, TensorFlow!')>>> sess = tf.Session()>>> print(sess.run(hello))Hello, TensorFlow!>>> a = tf.constant(10)>>> b = tf.constant(32)>>> print(sess.run(a + b))42>>>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

如果import报错,需要下载安装Microsoft Visual C++ 2015 Redistributable

另外需确认CUDA CUDNN与TensorFlow版本是否匹配

  • gpu使用情况查看
nvidia-smi -l # 实时返回GPU使用情况

原创粉丝点击