在Windows下安装TensorFlow

目前TensorFlow在Windows下只支持Python 3.x。

1.下载Python

首先安装Pythone 3.6.4

下载地址

升级pip

python.exe -m pip install --upgrade pip

安装tensorflow

CPU版本

pip install --upgrade tensorflow

GPU版本

pip install --upgrade tensorflow-gpu

安装TensorFlow的GPU支持包

安装CUDA Toolkit 9.1

https://developer.nvidia.com/cuda-downloads

安装cuDNN 7.1

https://developer.nvidia.com/cudnn

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

Comment