Windows下安装tensorflow步骤

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/chongtong/article/details/53905625

官方安装链接
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

python.exe -m pip install --upgrade pip

安装tensorflow

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

gpu版本tensorflow安装gpu支持包

安装cuda8.0

安装cudnn5.1

添加解压后的bin目录到PATH环境变量

测试tensorflow

$ python
...
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
b'Hello, TensorFlow!'
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> print(sess.run(a + b))
42
>>>

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

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

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

原文链接

猜你喜欢

转载自blog.csdn.net/chongtong/article/details/53905625