首先下载Anaconda,能够从清华大学的镜像网站进行下载。python
安装Anaconda,注意安装时不要将添加环境变量的选项取消掉。windows
安装完成以后,在安装目录下cmd,输入测试
conda list
能够查看Anaconda为咱们提供的集成环境:网站
下面只是一部分截图:url
查看版本信息:spa
conda --version
Anaconda 安装成功。code
接下来须要设置 Anaconda 仓库镜像,由于默认链接的是国外镜像地址,下载速度比较慢,咱们把镜像地址改成清华大学开源软件镜像站,Anaconda Prompt 窗口输入:blog
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
继续在 Anaconda Prompt 窗口输入:ip
conda create -n tensorflow python=3.5
表示建立 TensorFlow 依赖环境,TensorFlow 目前不支持Python3.6,这里咱们使用Python3.5。ci
控制台输出:
Fetching package metadata ............... Solving package specifications: . Package plan for installation in environment D:\Program Files\anaconda\envs\tensorflow: The following NEW packages will be INSTALLED: pip: 9.0.1-py35_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
python: 3.5.3-0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
setuptools: 27.2.0-py35_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
vs2015_runtime: 14.0.25123-0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
wheel: 0.29.0-py35_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
Proceed ([y]/n)? y
提示咱们安装哪些依赖软件,输入‘y’,回车。
安装 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
激活环境:
activate tensorflow
退出环境:
deactivate tensorflow
进入到 Anaconda 安装目录下 /envs /tensorflow 文件夹,继续在 Anaconda Prompt 窗口输入输入:
python.exe
输入:
>>> import tensorflow as tf >>> hello = tf.constant('Hello, TensorFlow!') >>> sess = tf.Session() >>> sess.run(hello) b'Hello, TensorFlow!'