Install Tensorflow in Win10 Anaconda

Friends in need can refer to

1. Install Anaconda

 Download: https://www.continuum.io/downloads, I am using Python 3.5 

After downloading, install it.
 
After installation, open Anaconda Prompt and enter Tsinghua's warehouse image to update the package faster:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes

It is recommended to enter the first command line twice, in order to put the mirror address first.

2. Install TensorFlow

Continue to open Anaconda Prompt and enter:
conda create -n tensorflow python=3.5

After installation, enter:
activate tensorflow

After activation, I chose to install the CPU version and entered:
 
If the installation fails, try several times

3. Test:

 
 1 # 进入一个交互式 TensorFlow 会话.
 2 import tensorflow as tf
 3 sess = tf.InteractiveSession()
 4 
 5 x = tf.Variable([1.0, 2.0])
 6 a = tf.constant([3.0, 3.0])
 7 
 8 # 使用初始化器 initializer op 的 run() 方法初始化 ‘x‘ 
 9 x.initializer.run()
10 
11 # 增加一个减法 sub op, 从 ‘x‘ 减去 ‘a‘. 运行减法 op, 输出结果 
12 sub = tf.sub(x, a)
13  sub.eval()
14 # ==> [-2. -1.]

 

4、关闭

当你不用 TensorFlow 的时候,关闭环境:

  deactivate
 

在Win10 Anaconda中安装Tensorflow

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326039750&siteId=291194637