解决 Could not load dynamic library libcudart.so.10.1

环境:

  • python 3.6.8
  • tensorflow-gpu 2.3.0rc0
  • CUDA 10.0
  • cudnn 7

错误:

Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory
Could not load dynamic library 'libcublas.so.10'; dlerror: libcublas.so.10: cannot open shared object file: No such file or directory
Could not load dynamic library 'libcufft.so.10'; dlerror: libcufft.so.10: cannot open shared object file: No such file or directory
Could not load dynamic library 'libcurand.so.10'; dlerror: libcurand.so.10: cannot open shared object file: No such file or directory
Could not load dynamic library 'libcusolver.so.10'; dlerror: libcusolver.so.10: cannot open shared object file: No such file or directory
Could not load dynamic library 'libcusparse.so.10'; dlerror: libcusparse.so.10: cannot open shared object file: No such file or directory

原因:

Tensorflow-gpu 2.0.0 以上 开始 需要 CUDA10.1 

解决:

#cd /usr/local/cuda/lib64     #进入对应CUDA地址

sudo cp libcublas.so.10.0 libcublas.so.10
sudo cp libcufft.so.10.0 libcufft.so.10
sudo cp libcurand.so.10.0 libcurand.so.10
sudo cp libcusolver.so.10.0 libcusolver.so.10
sudo cp libcusparse.so.10.0 libcusparse.so.10

测试:

import tensorflow as tf
if tf.test.gpu_device_name():
    print('Default GPU Device: {}'.format(tf.test.gpu_device_name()))
else:
    print("Please install GPU version of TF")

猜你喜欢

转载自blog.csdn.net/qq_19707521/article/details/107384416