TensorFlow记录

TensorFlow的环境准备
一: 安装
首先安装python,下载地址
https://www.python.org/downloads/windows/
最初下载3.7版本,结果安装不上tensorflow
之后下载了3.6.6版本

安装python:
在powershell中执行命令:pip install tensorflow1.1.0
提示错误,
Could not find a version that satisfies the requirement tensorflow
1.1.0 (from versions: 1.2.0rc2, 1.2.0, 1.2.1, 1.3.0rc0, 1.3.0rc1, 1.3.0rc2, 1.3.0, 1.4.0rc0, 1.4.0rc1, 1.4.0, 1.5.0rc0, 1.5.0rc1, 1.5.0, 1.5.1, 1.6.0rc0, 1.6.0rc1, 1.6.0, 1.7.0rc0, 1.7.0rc1, 1.7.0, 1.7.1, 1.8.0rc0, 1.8.0rc1, 1.8.0, 1.9.0rc0, 1.9.0rc1, 1.9.0rc2, 1.9.0, 1.10.0rc0, 1.10.0rc1, 1.10.0, 1.11.0rc0, 1.11.0rc1, 1.11.0rc2, 1.11.0, 1.12.0rc0)
No matching distribution found for tensorflow==1.1.0,
直接忽略版本号,pip install tensorflow安装。

安装成功后,测试一下,出现了如下一个警告

import tensorflow as tf
sess=tf.Session()
2018-10-12 13:33:14.783820: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2

a=tf.constant(10)
b=tf.constant(4)
print(sess.run(a+b))
14

改下log级别就可:
import os
os.environ[‘TF_CPP_MIN_LOG_LEVEL’] = ‘2’
参考: https://blog.csdn.net/hq86937375/article/details/79696023
https://blog.csdn.net/qq_41185868/article/details/79127838

猜你喜欢

转载自blog.csdn.net/m0_37605956/article/details/83061904
今日推荐