ubuntu - ImportError : libcudnn. so.6:无法打开共享对象文件:没有这样的文件或目录

标签 ubuntu tensorflow tensorflow-gpu

导入 Tensorflow 时出现以下错误。

    >>> import tensorflow
Traceback (most recent call last):
  File "/home/jarvis/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/jarvis/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/jarvis/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "/home/jarvis/anaconda3/lib/python3.6/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/home/jarvis/anaconda3/lib/python3.6/imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: libcudnn.so.6: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jarvis/anaconda3/lib/python3.6/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "/home/jarvis/anaconda3/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/home/jarvis/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/home/jarvis/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/jarvis/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/jarvis/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "/home/jarvis/anaconda3/lib/python3.6/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/home/jarvis/anaconda3/lib/python3.6/imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: libcudnn.so.6: cannot open shared object file: No such file or directory


Failed to load the native TensorFlow runtime.

我也添加了路径变量
$ export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
$ export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

然后系统检测到nvcc。
但是,只要关闭终端窗口并在新终端中键入 nvcc -V ,它就会再次显示未安装

最佳答案

对我有用的一件事是,我没有使用 'export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64"',而是使用了 'export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:~/cuda/lib64"',它确实有效。每次计算机启动时我都必须这样做。不知道 cuda 在我的主文件夹中做什么,也不知道为什么我每次都需要这样做。

关于ubuntu - ImportError : libcudnn. so.6:无法打开共享对象文件:没有这样的文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46032913/

相关文章:

git - svn 到 git 的转换

python - 我可以将我的 TensorFlow Python 环境从 Windows 转移到 Ubuntu 吗?

python - 在 TensorflowJS 中构建神经网络

python - [tensorflow]安装 tensorflow-gpu,导入错误为段错误(核心转储)

tensorflow - 如何在具有数据并行性的多个 GPU 上运行 Tensorflow Estimator

shell - 使用fish-shell在提示时输出奇怪的文本

ubuntu - deb 包中的版权文件 - 如何

linux - 通过 SSH 的 X Window 将不会出现

tensorflow - 加载模型后 Keras 精度低