关于tensorflow:libcublas.so.9.0:无法打开共享对象文件:Ubuntu 18.04中没有这样的文件或目录

libcublas.so.9.0: cannot open shared object file: No such file or directory in Ubuntu 18.04

我正在尝试在Ubuntu 18.04中安装tensorflow。 CUDA和cudnn测试全部通过。 测试tensorflow安装时,这个问题的标题是我的错误。 我看到同样的问题要求Ubuntu 16.04,但答案并没有立即有用。 一个答案建议使用strace,但我不理解输出。

这是我的完整错误消息:

Traceback (most recent call last):
File"/home/dma/tensorflow/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File"/home/dma/tensorflow/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File"/home/dma/tensorflow/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/dma/tensorflow/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File"/home/dma/tensorflow/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: libcublas.so.9.0: 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"", line 1, in
File"/home/dma/tensorflow/lib/python3.6/site-packages/tensorflow/init.py", line 22, in
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File"/home/dma/tensorflow/lib/python3.6/site-packages/tensorflow/python/init.py", line 49, in
from tensorflow.python import pywrap_tensorflow
File"/home/dma/tensorflow/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File"/home/dma/tensorflow/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File"/home/dma/tensorflow/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File"/home/dma/tensorflow/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/dma/tensorflow/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File"/home/dma/tensorflow/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: libcublas.so.9.0: 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.


附加:

1
2
export  PATH=/usr/local/cuda/bin:$PATH
export  LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH 

/etc/profile

然后,重启。

如果您没有在/usr/local中与cuda-9.0链接的softlink cuda,请首先创建一个软链接或修改上述路径以获得所需内容。


使用虚拟环境将软件包安装与系统隔离,正如在tensorflow安装指南中建议的那样,为我修复它。

https://www.tensorflow.org/install/pip