tensorflow(GPU) win10 下安装(根据tensorflow官方文档)

操作系统win10 显卡好像是gx970
1 安装cuda 9.0 下载地址
 https://developer.nvidia.com/cuda-90-download-archive?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exenetwork


选择 Base Installer 之后需要将安装路径C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\添加到path里边 否则可能安装完运行报dllnot fount的错误,
在https://developer.nvidia.com/rdp/cudnn-download 安装cudnn 7 

解压后将文件复制到差不多 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\ 路径下

2 安装 Anaconda
 Anaconda好像有自带python 在Anaconda 命令行中输入下边命令创建tensorflow python环境
C:> conda create -n tensorflow pip python=3.5
输入 activate tensorflow
输入pip install --ignore-installed --upgrade tensorflow-gpu 开始安装
3 测试
Anaconda命令行输入python进入python环境命令
输入
>>> import tensorflow as tf
>>> hello = tf . constant ( 'Hello, TensorFlow!' )

>>> sess = tf.Session()

>>> print(sess.run(hello))

print前 注意不要有空格否则可能会报错(类似File "<stdin>", line 1)。。

打印Hello, TensorFlow! 证明安装成功

安装 Jupyter notebook 
(tensorflow)D:\>conda install ipython
···
(tensorflow)
D:\>conda install jupyter
···
(tensorflow)D:\>ipython kernelspec install-self --user
打开Jupyter notebook 输入下边命令运行测试
import numpy as np
import tensorflow as tf
hello = tf.constant('hello')
sess = tf.Session()
print(sess.run(hello))

猜你喜欢

转载自blog.csdn.net/fdbvm/article/details/79315695