Install tensorflow in anaconda

Open Anaconda Prompt,

step1: Enter the Tsinghua warehouse image

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

 

step2: Build the tensorflow environment

Enter conda create -n tensorflow python= 3.5

After the end, you can see tensorflow in the environment in anaconda,

 

step3: Enter activate tensorflow

(switch to that environment)

 

 

step4: Install the cpu version of TensorFlow

输入pip install --upgrade --ignore-installed tensorflow
开始安装,网速快的话5分钟左右就ok!!


安装好了 successfully .....

step5: Test tensorflow
Start the tensorflow environment in Anaconda Prompt and enter the python environment

Enter code:

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

The displayed result is as follows, indicating that it has been successful.

 The key!!! In spyder 'import tensorflow' prompts an error...why?? shows No module named 'tensorflow' ,

In the environment tensorflow of anaconda navigator, select Not installed in the upper menu, search for spyder, (I have installed it here, so I can't find it)

Select spyder, there is apply at the bottom right, install the plugin, for about 5 minutes 

Finally, in installed, you can find that spyde already exists, and then you can use it in spyder!!

 




 

Guess you like

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