CPU版本的Tensorflow安装

CPU版本的Tensorflow安装

今天朋友通过微信帮忙安装好了CPU版本的Tensorflow,今天就写一篇博客来记录一下,也算是作为一个 总结。
1.首先CPU版本的是不需要安装Cuda的,这样就简单了很多。这里cuda可以简单的理解为是和GPU联系的一个纽带。
2.打开Anaconda,输入pip install tensorflow,用此命令进行安装。也可以直接输入(pip install --index-url https://pypi.douban.com/simple tensorflow)这段是2.4.1版本的安装。(pip install --index-url https://pypi.douban.com/simple tensorflow1.9.0)这是1.9版本的安装。
(pip install --index-url https://pypi.douban.com/simple tensorflow
1.4.0)这是1.4版本的安装。(pip install --index-url https://pypi.douban.com/simple tensorflow==2.2.0)这是2.2版本的安装,我安装的2.2版本。
3.在Anaconda里面输入python,在python环境里面输入(import tensorflow as tf)进行检验是否安装成功,然后输入
sess = tf.Session() (如果是2.几的版本则不需要这一行,因为2.几的版本没有Session)
a = tf.constant(1)
b = tf.constant(2)
print(sess.run(a+b)) 来检验是否安装成功。
如果没有报错就说明行了。

猜你喜欢

转载自blog.csdn.net/weixin_51610638/article/details/115333726