win10安装Tensorflow2

人工智能207

**

win10安装Tensorflow2

**
一:安装Anaconda
步骤:

1:从官方网站下载Anaconda
https://www.anaconda.com/download/
win10安装Tensorflow2

2:进行软件安装
注意一点:第一个勾选后添加到系统环境变量。
win10安装Tensorflow2

3:安装完成Anaconda之后进行环境变量的测试
进入到windows中的命令模式:

检测anaconda环境是否安装成功:conda --version
win10安装Tensorflow2
二:安装Tensorflow2
1、官网上(https://tensorflow.google.cn/install?hl=zh_cn)描述的系统要求:
win10安装Tensorflow2
上述文字中要求的可再发行软件包链接:
https://docs.microsoft.com/zh-CN/cpp/windows/latest-supported-vc-redist?view=msvc-170

2、安装步骤:
命令行中输入以下指令进行安装:
pip3 install --user --upgrade tensorflow
注意:网速慢可能导致安装失败,可再次输入指令重新安装。
安装成功后的部分显示:
win10安装Tensorflow2

win10安装Tensorflow2
3、验证是否安装成功
在开始菜单中打开Spyder:
win10安装Tensorflow2

测试代码:

import tensorflow as tf

tf.compat.v1.disable_eager_execution()

a = tf.constant(5.0)
b = tf.constant(7.0)
c = a * b

sess = tf.compat.v1.Session()

print(sess.run(c))

输出(dll加载错误是因为没有安装gpu部分,可忽略):
win10安装Tensorflow2

Original: https://blog.csdn.net/weixin_39108302/article/details/122811466
Author: weixin_39108302
Title: win10安装Tensorflow2