【Aming】win10用anaconda3安装 TensorFlow

在网上找了好多教程,安装了这个那个,也踩了好多坑。主要是看不明白到底是出了什么问题。哎,菜鸡还是分享一下我的安装过程吧。

我的整体配置:

  • Windows10
  • anaconda3
  • CUDA v11.1
  • cuDNN v8.0.4

我安装了TensorFlow和TensorFlow-gpu两个版本,cuda和cudnn是需要用gpu版本的情况下下载。因为我也不太懂后面需不需要,所以我就都下载了。

1.安装anaconda 官网链接:

https://www.anaconda.com/products/individual#Downloads

 这个是别的教程的截图 我已经安装过了就不重新安装了。注意的就是这个,其他正常安装。

安装完之后: 

 2.安装CUDA 

这个要看你电脑是否有N卡 就是NVDIA显卡。在【此电脑-属性-设备管理器-显示适配器】看,如果有,就可以用

 下载链接:

https://developer.nvidia.com/cuda-downloads?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exelocal

 安装教程:

https://blog.csdn.net/sinat_23619409/article/details/84202651

3.安装cuDNN 一定要选择与cuda版本匹配的

下载链接:(要先注册Could not load dynamic library 'cusolver64_10.dll'; dlerror: cusolver64_10.dll not found)

https://developer.nvidia.com/rdp/cudnn-archive

我安装的:

 安装教程同上cuda的教程:

https://blog.csdn.net/sinat_23619409/article/details/84202651

4.激动人心的安装TensorFlow环节

可以在下载之前加上清华源,下载的十分快~!

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes

教程: 都作为参考哈~

安装gpu版本的 在pip 命令之后用tensorflow-gpu就行

https://blog.csdn.net/weixin_42555080/article/details/100704078

https://blog.csdn.net/u010858605/article/details/64128466

注:安装之后的import tensorflow as tf ...这个测试有问题,看下面踩坑:

踩坑:

乱七八糟的问题,重要的是以下两个大大大坑:

1.Could not load dynamic library 'cusolver64_10.dll'; dlerror: cusolver64_10.dll not found

解决:https://blog.csdn.net/yijiancmy/article/details/105588156

2.最烦人的大坑:AttributeError: module 'tensorflow' has no attribute 'Session'

RuntimeError: The Session graph is empty. Add operations to the graph before

我找了好多,说是TensorFlow2版本和1版本的函数不互通

链接:https://blog.csdn.net/weixin_38410551/article/details/103631977

https://blog.csdn.net/qq_33440324/article/details/94200046

两个版本TensorFlow函数对照:https://docs.google.com/spreadsheets/d/1FLFJLzg7WNP6JHODX5q8BDgptKafq_slHpnHVbJIteQ/edit#gid=0

最后我的验证程序是这样的 我也不知道这xla是啥 希望能知道怎么解决的可以帮帮我呀

 

先弄到这,后续有问题再补充~嘻嘻

原文地址:https://www.cnblogs.com/Aming-/p/14252150.html