Window下安装TensorFlow(CPU版)

1、卸载python2.7,TensorFlow是基于python3.0版本的,查资料表示两个版本的python可以共存,但是我一直安装不成功,果断卸载了python2.7,然后一步成功。

2、安装Anaconda3,包含了python3

3、pip install --upgrade tensorflow        (安装TensorFlow)

4、会报错,需要更新pip(两种方法)

①python -m pip install --upgrade pip(更新pip)

②python -m pip install -U pip             (更新pip)

5、重新执行第3步

6、(Cannot remove entries from nonexistent file d:\myanaconda\lib\site-packages\easy-install.pth,会报一个错,版本太低的错误,执行下面命令)

pip install --upgrade --ignore-installed setuptools

7、success提示,然后运行.py文件(打印hello TensorFlow)

8、源码(.py文件)

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

9、说明:这是cpu版的TensorFlow

猜你喜欢

转载自blog.csdn.net/hqh131360239/article/details/79662357