2017-09-04 56 views
-1

導入Tensorflow時出現以下錯誤。ImportError:libcudnn.so.6:無法打開共享目標文件:沒有這樣的文件或目錄

>>> 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,它再次顯示未安裝

回答

0

實際上,我在安裝根據官方的安裝文件tensorflow GPU的遇到了這個問題。我通過更改tensorflow-gpu的版本來解決它。

pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.3.0-cp36-cp36m-linux_x86_64.whl 

我換了號碼1.3.0至1.2.0,它works.the新安裝稱道的是如下:

爲我工作
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.2.0-cp36-cp36m-linux_x86_64.whl 
1

一件事是,而不是使用「導出LD_LIBRARY_PATH =「$ LD_LIBRARY_PATH:/ usr/local/cuda/lib64」'我使用'export LD_LIBRARY_PATH =「$ LD_LIBRARY_PATH:〜/ cuda/lib64」'並且它工作正常。每次電腦啓動時我都必須這樣做。不知道cuda在我的個人文件夾中做什麼,也不知道爲什麼我需要每次都做。

相關問題