1、首先windows10下我这边环境是CPU环境,先得装置anaconda
我用国内镜像源进行装置

https://mirrors.bfsu.edu.cn/a...

装置后关上anaconda prompt进行镜像源的配置,此处也能够不进行国内源配置,依据电脑状况:

conda config --add channels https://mirrors.tuna.tsinghua...

conda config --set show_channel_urls yes

conda create -n tensorflow python=3.7.1 --依据本人Python版本也就是TensorFlow的环境筹备

activate tensorflow --激活tensorflow

2、之后装置最新的tensorflow
pip3 install -i https://mirrors.aliyun.com/py... --upgrade tensorflow --default-timeout=600

也就是--upgrade tensorflow是获取最新的镜像版本,之后--default-timeout=600是怕下载时超时,此处tensorflow尽量装置最新版本的,要不然应用的时候会提醒异样

3、装置实现后,则能够在pycharm外面进行验证应用
2.0版本此处tensorflow应用session须要降版本,采坑:
import tensorflow as tf

tf.compat.v1.disable_eager_execution()

hello = tf.constant('hello,tf')

sess = tf.compat.v1.Session()

print(sess.run(hello))


当打出hello时,证实运行胜利!

心愿对大家有帮忙!