一、 安装环境
Windows 10
Python 3.5.2
Anaconda3-4.2.0-Windows-x86_64.exe
二、 下载资源来自国内清华镜像网站(清华大学开源软件镜像网站:https://mirrors.tuna.tsinghua.edu.cn)
Anaconda3-4.2.0-Windows-x86_64.exe: https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/
三、 安装TensorFlow
安装过程一般是从anaconda仓库中下载,下载网址在国外,当然国外下载会很慢,镜像网站你值得拥有。所以需要先修改下载地址。
1. 打开刚刚安装好的Anaconda中的 Anaconda Prompt,然后输入:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
这两行代码用来改成连接清华镜像的
2.接下来安装Tensorflow,在Anaconda Prompt中输入:
conda create -n tensorflow python=3.5.2

等待一会。。。。。。 输入 y 。
会有如下

看到上面这些 activate tensorflow(这么直白的英语,看看是不是很激动,)恭喜你,tensorflow你已经安装成功啦,去激活一下,紧接着输入:“activate tensorflow”就Ok了。我们要安装的是CPU版本,那么在命令下紧接着输入:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ https://mirrors.tuna.tsinghua.edu.cn/tensorflow/windows/cpu/tensorflow-1.1.0-cp35-cp35m-win_amd64.whl
如果出现 404错误可以输入:
pip install https://mirrors.tuna.tsinghua.edu.cn/tensorflow/windows/cpu/tensorflow-1.1.0-cp35-cp35m-win_amd64.whl
你也可以自己选择对应的Tensorflow版本,可以在清华镜像中查看这样就说明安装成功。

四、测试
import tensorflow as tf
hello = tf.constant(‘Hello, Tensorflow!’)
sess = tf.Session()
print(sess.run(hello))
a = tf.constant(10)
b = tf.constant(22)
print(sess.run(a+b))
五、 安装过程出现的问题

这样忽略红色的部分,在命令框输入:
python -m pip install --upgrade pip

然后接着安装TensorFlow就OK;
本文介绍在Windows 10系统下安装TensorFlow的详细步骤。包括安装Python、Anaconda,从清华镜像网站下载资源,修改下载地址以加快速度,安装CPU版本的TensorFlow,还给出测试代码。此外,提及安装过程中出现问题的解决办法。
273

被折叠的 条评论
为什么被折叠?



