声明版本:
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