前期所需要的准备:
1.Nvidia驱动安装:参考我的博客
https://blog.csdn.net/nohopenolove/article/details/107138410
2.Ubuntu16.04安装Anaconda,版本查询及步骤,参考我的这篇博客
https://blog.csdn.net/nohopenolove/article/details/107147461
3.Ubuntu16.04下安装cuda和cudnn的三种方法,参考这篇博客:
https://blog.csdn.net/wanzhen4330/article/details/81699769?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.edu_weight&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.edu_weight#%C2%A0%20%C2%A0%20%C2%A01.3%C2%A0%20%E7%BB%88%E6%9E%81%E6%9D%80%E6%89%8B%E9%94%8F
4.0安装Tensorflow,先看官网,配置依赖项目https://tensorflow.google.cn/install/source这里主要是为了安装Bazel,版本cuda和cudnn版本、tensorflow版本综合考虑这篇博客https://blog.csdn.net/qiancaobaicheng/article/details/95226499和Tensorflow官网
5.0正式安装采用pip安装,参考博客https://blog.csdn.net/weixin_42101286/article/details/89238025下载的是清华大学镜像源
6.0安装过程中遇到pip版本太低就按照提示更新pip,遇到安装的问题时参考这篇博客https://blog.csdn.net/qq_40247920/article/details/103892696算然是windows下的错误解决但是Ubuntu下通用,解决问题后重新pip安装清华镜像源。
7.0测试TensorFlow2.0https://blog.csdn.net/qq_44774398/article/details/99832436
网上的很多测试例子喜欢这么测试:
import tensorflow as tf
hello = tf.constant("Hello World, TensorFlow!")
sess = tf.Session()
print(sess.run(hello))
但是对于TensorFlow2.0来说,会报错,因为TensorFlow2.0相比较于已经改动了不少,把上述的测试代码改为:
import tensorflow as tf
tf.compat.v1.disable_eager_execution()
hello = tf.constant('Hello, TensorFlow!')
sess = tf.compat.v1.Session()
print(sess.run(hello))
参考博客为https://blog.csdn.net/fangyan90617/article/details/103648987
其他参考博客:
https://blog.csdn.net/Taylent/article/details/99604468?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.edu_weight&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.edu_weight