TensorFlow:ImportError: libcudnn.so.*: cannot open shared object file: No such file or dictionary

环境:

  • Ubuntu16.04
  • Nvidia 384
  • CUDA 8.0
  • cuDNN 5

错误

TensorFlow、CUDA、cuDNN的版本关系小白我时常懵懵的,经常出现各种不支持的情况,比如今天安装了TensorFlow1.4,报错:ImportError: libcudnn.so.6: cannot open shared object file: No such file or dictionary


错误缘由

google了一圈发现, 问题出在 TensorFlow 1.4-gpu 是基于cuDNN6,需要的也就是libcudnn.so.6了。


解决方案:

  • Just download cuDNN v6 and follow the steps (Tested on Ubuntu 16.04, CUDA toolkit 8.0 )https://developer.nvidia.com/cudnn
    $ tar xvzf cudnn-8.0-linux-x64-v5.1-ga.tgz
    $ sudo cp -P cuda/include/cudnn.h /usr/local/cuda/include
    $ sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda/lib64
    $ sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
  • Now set Path variables
  • $ vim ~/.bashrc
    翻到最底部加上:
    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"
    export CUDA_HOME=/usr/local/cuda

参考:http://blog.csdn.net/hungryof/article/details/52746279

你可能感兴趣的:(机器学习,AI学习,实践记录)