tensorflow遇到的问题

1. 找不到动态库cudart64_101.dll

Could not load dynamic library ‘cudart64_101.dll’; dlerror: cudart64_101.dll not found

解决方法

点击下载动态库
解压后放在C:\Windows\System32

2. If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.

错误提示

TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:

  1. Downgrade the protobuf package to 3.20.x or lower.
  2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

解决方法

先去卸载protobuf:

pip uninstall protobuf

然后重新安装3.19.0:

pip install protobuf==3.19.0

3. Could not load dynamic library ‘cusolver64_10.dll’; cusparse64_10.dll;cudnn64_7.dll

错误提示

错误信息
到了这一步基本上就完成了tensorflow-gpu的安装,先恭喜一波~~~

解决方法

先到

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v你的版本\bin

中找到cusolver64_11.dll,cusparse64_11.dll,cudnn64_8.dll这几个缺失的动态库
2.复制到桌面,修改成cusolver64_10.dll,cusparse64_10.dll,cudnn64_7.dll
3. 将修改后的文件复制到刚才的bin目录中。

在pycharm中测试是否安装成功:

import tensorflow as tf

gpus = tf.config.list_physical_devices('gpu')
print(gpus)
print(123)

如果出现下方成功提示,说明安装完成。
在这里插入图片描述

4. No module named ‘tensorflow_addons’

问题

No module named ‘tensorflow_addons’
ImportError: cannot import name ‘keras_tensor‘ from ‘tensorflow.python.keras.engine‘
两个都是同样的方法

方法

先尝试安装

pip install tensorflow_addons

不成功然后按照下图按照对应的版本
版本对应

5.Loaded runtime CuDNN library: 7.5.1 but source was compiled with: 7.6.5. CuDnn

问题

在运行tensorflow的时候,运行环境是cudnn的7.5.1,编译时用的是cudnn的7.6.5。
在anaconda安装目录中找到对应的cudnn版本,然后替换掉cuda安装时的cudnn版本。

方法

1,在anaconda目录的pkgs目录中找到cudnn版本
anaconda中找到cudnn
2,进入该目录下的Library,打开里面的文件夹,可以看到对应的cudnn库
cudnn
等会将bin目录下的cudnn64_7.dll,include目录下的cudnn.h,lib\x64目录下的cudnn.lib放到cuda对应的目录下。

3,找到cuda的安装目录,如我的是C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1
在这里插入图片描述
4, **为了以防万一,可以先将要覆盖的文件保存一下。**将刚才anaconda中找到的cudnn库放到对应的cuda目录下。

不定期持续更新ing

  • 4
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值