tensorflow gpu踩坑记录

声明版本:

python版本--3.7.6
cuda版本--11.4.0
cudnn版本--8.2
tensorflow-gpu版本--2.4.0

①解决Not creating XLA devices, tf_xla_enable_xla_devices not set:

在import tensorflow后加(如果不加会报错,则每次都要加)
import os
os.environ['TF_XLA_FLAGS'] = '--tf_xla_enable_xla_devices'

②解决Could not load dynamic library 'cusolver64_10.dll'; dlerror: cusolver64_10.dll not found

将C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\bin中的cusolver64_11.dll更名为cusolver64_10.dll

③导入tensorflow测试是否成功

import tensorflow as tf
tf.test.is_gpu_available()

④解决Could not load dynamic library 'cudart64_100.dll'; dlerror: cudart64_100.dll not found

缺少cudar64_100.dll,去官网下载,并放入C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\bin中​​​​​​https://download.zip.dll-files.com/f0ab3cac7e90959a38e97b262ebdf3f2/cudart64_100.zip?token=TgabjjguiZ8vuxLodfS1MQ&expires=1637069619https://download.zip.dll-files.com/f0ab3cac7e90959a38e97b262ebdf3f2/cudart64_100.zip?token=TgabjjguiZ8vuxLodfS1MQ&expires=1637069619

 ⑤解决pip install --upgrade tensorflow报错

ERROR: Could not find a version that satisfies the requirement werkzeug>=0.11.15 (from tensorboard~=2.6->tensorflow) (from versions: none)
ERROR: No matching distribution found for werkzeug>=0.11.15 (from tensorboard~=2.6->tensorflow)

 将pip install --upgrade tensorflow改为pip --trusted-host pypi.python.org install --upgrade tensorflow

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值