问题描述
出现了一堆缺少dll文件的报错,这里只是其中一个,还有好多文件。
解决方法
方法1
放置cudart64_101.dll到指定文件夹
验证代码
import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
print(tf.__version__)
a = tf.constant(1.)
b = tf.constant(2.)
print(a+b)
print('GPU:', tf.test.is_gpu_available())
方法2
如下图:
当前tensorflow版本
如果嫌麻烦,也可以直接运行下面代码,降版本
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow-gpu==2.3.0
验证代码,使用下面的程序段可以查看能否能读取显卡
import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
print(tf.__version__)
a = tf.constant(1.)
b = tf.constant(2.)
print(a+b)
print('GPU:', tf.test.is_gpu_available())
输出以下结果则成功