third-party dynamic library (libcudnn.so) that Paddle depends on is not configured correctl

运行百度飞桨的代码,报以下错误,并给出提示,是由于cuda没有配置好导致的报错。

W0705 10:39:02.694573 2471961 gpu_context.cc:278] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 11.4, Runtime API Version: 11.2
W0705 10:39:02.694808 2471961 dynamic_loader.cc:305] The third-party dynamic library (libcudnn.so) that Paddle depends on is not configured correctly. (error code is /usr/local/cuda/lib64/libcudnn.so: cannot open shared object file: No such file or directory)
  Suggestions:
  1. Check if the third-party dynamic library (e.g. CUDA, CUDNN) is installed correctly and its version is matched with paddlepaddle you installed.
  2. Configure third-party dynamic library environment variables as follows:
  - Linux: set LD_LIBRARY_PATH by `export LD_LIBRARY_PATH=...`
  - Windows: set PATH by `set PATH=XXX;

在这里插入图片描述
但是电脑是安装过paddle,并运行成功过gpu代码的,所以应该配置好了cuda和cudnn。
third-party dynamic library (libcudnn.so) that Paddle depends on is not configured correctl_第1张图片

解决步骤(linux环境下:设置 “LD_LIBRARY_PATH” 动态链接库):

  1. 查找Linux普通用户在自己的Anaconda虚拟环境目录中的cudnn
    (paddle) ninjia@ailian-G4228-TRT:~/anaconda3/envs/paddle/lib$ pwd
    /home/ninjia/anaconda3/envs/paddle/lib
    
  2. 在 /home/ninjia目录下的配置文件 .bashrc 或者 .bash_profile 中加入 export 语句,前者在每次登陆和每次打开 shell 都读取一次,后者只在登陆时读取一次。我的习惯是加到 ~/.bashrc 中,在该文件的未尾,可采用如下语句来使设置 “动态链接库” LD_LIBRARY_PATH生效:
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ninjia/anaconda3/envs/paddle/lib
    
  3. 修改完后,source .bashrc 生效
    (base) ninjia@ailian-G4228-TRT:~$ source .bashrc
    

LD_LIBRARY_PATH详解

LD_LIBRARY_PATH详解
LD_LIBRARY_PATH是Linux环境变量名,该环境变量主要用于指定查找共享库(动态链接库)时除了默认路径之外的其他路径。




参考资料:
PreconditionNotMetError: The third-party dynamic library (libcublas.so) that Paddle depends on is no
linux 的 LD_LIBRARY_PATH 变量设置
设置 Linux 的 LD_LIBRARY_PATH 变量
The third-party dynamic library (libcudnn.so) that Paddle depends on is not configured correctly
LD_LIBRARY_PATH详解

你可能感兴趣的:(Linux,#,Paddle/百度飞桨,paddle)