小白学习之Tensorflow安装

Tensorflow安装以及填坑

Tensorflow安装过程中会出现各种问题,经过无数次跳坑之后,终于解决问题,所以就记录一下:
(1)环境:
Win10
(2)安装步骤:
a.安装VC2015(这是基础)
b.安装Anaconda
安装地址:https://www.anaconda.com/
选择合适自己的版本就很好啦
注:安装过程中默认的两个选项都选上,path路径会自动添加,还会下载相应的python版本
(3)检测是否安装成功
Win+cmd进入后台,输入conda --version
会出现conda版本号
输入python --version,可以查看当前python版本号
(4)安装tensorflow
pip install --upgrade --ignore-installed tensorflow -i https://pypi.douban.com/simple
注意:
这个过程极其漫长,很大可能会失败,所以,这里直接加入豆瓣镜像,个人感觉非常好用,原博客地址(https://blog.csdn.net/mrslw/article/details/84988672)
(5)测试
进入Anaconda Prompt,按照如下测试:
activate tensorflow
python
import tensorflow
出现【No module named ‘tensorflow’】,输入
pip install --upgrade -I setuptools
【原文地址:https://blog.csdn.net/zinkin14/article/details/79235314】
pip install --upgrade --ignore-installed tensorflow -i https://pypi.douban.com/simple(这里同样使用豆瓣镜像,个人感觉非常好用)
activate tensorflow
python
import tensorflow as tf
tf.compat.v1.disable_eager_execution()
hello = tf.constant(‘Hello, tensorflow!’)
sess = tf.compat.v1.Session()
print(sess.run(hello))
出现b’Hello, tensorflow!'安装成功
(6)Tips
笔者安装的anaconda是V4.8.2, Python是V3.7.6, tensorflow是V2.0.0的。

原创文章 2 获赞 0 访问量 86

猜你喜欢

转载自blog.csdn.net/qq_43517415/article/details/104901223