系統linux,python3.6,安裝好cuda,和cudnn7.1.2,和tensorflow-gpu,后運行如下
>>> import tensorflow as tf
Traceback (most recent call last):
File "/home/serlon/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/serlon/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/serlon/.local/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 "/usr/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: libcudnn.so.7: 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/serlon/.local/lib/python3.6/site-packages/tensorflow/__init__.py", line 22, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "/home/serlon/.local/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/serlon/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/serlon/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/serlon/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/serlon/.local/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 "/usr/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: libcudnn.so.7: cannot open shared object file: No such file or directory
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
而那個檔案明顯在/usr/local/cuda/lib64中
serlon@serlon-System-Product-Name:/$ echo $LD_LIBRARY_PATH
/usr/local/cuda/lib64
serlon@serlon-System-Product-Name:/$ ll /usr/local/cuda/lib64/ |grep libcudnn
lrwxrwxrwx 1 root root 13 7月 26 04:43 libcudnn.so -> libcudnn.so.7*
lrwxrwxrwx 1 root root 17 7月 26 04:42 libcudnn.so.7 -> libcudnn.so.7.1.2*
-rwxr-xr-x 1 root root 330735920 7月 26 04:37 libcudnn.so.7.1.2*
-rw-r--r-- 1 root root 327412782 7月 26 04:37 libcudnn_static.a
uj5u.com熱心網友回復:
博主,請問您問題解決了嗎uj5u.com熱心網友回復:
要學會搜索,只要將報錯資訊的關鍵行,去搜索一下,80% 都可以找到答案。報錯資訊提示明顯是缺檔案(依賴庫)

試試下面的方法,

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/124954.html
上一篇:請問怎么才能去觸發這個web事件
