ubuntu - ImportError : libcublas. so.9.0 : cannot open shared object file: No such file or directory (UBUNTU 16. 04)

标签 ubuntu tensorflow ubuntu-16.04

我正在尝试通过原生 pip3 安装方法安装 Tensorflow GPU 版本。安装成功,没有任何错误。但是,在验证安装时,我收到了上述错误。

Python 3.5.2 (default, Nov 23 2017, 16:37:01) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
  File "/home/batman/.local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/batman/.local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/batman/.local/lib/python3.5/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.5/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/lib/python3.5/imp.py", line 342, 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 "<stdin>", line 1, in <module>
  File "/home/batman/.local/lib/python3.5/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *  # pylint: disable=redefined-builtin
  File "/home/batman/.local/lib/python3.5/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/home/batman/.local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/home/batman/.local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/batman/.local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/batman/.local/lib/python3.5/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.5/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/lib/python3.5/imp.py", line 342, 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.

最佳答案

假设目标系统(您的计算机)已安装 CUDA 9 并因此可在运行时动态加载,您通过 pip(官方)下载的轮子已创建。

错误评估 libcublas.so.0无法导入( ImportError ),这意味着 .so找不到文件(动态库)。
因此,您只需在系统上安装 CUDA 9 即可使其正常工作。
沉迷于cuda,然而,你还需要安装cudnn v7.0 是 NVIDIA 创建的深度神经网络库(tensorflow 在内部使用)。

官方指南中列出了所有安装步骤:https://www.tensorflow.org/install/install_linux

另一个有用的引用可以是关于如何安装 CUDA 9 的 askubuntu 上的这个答案:https://askubuntu.com/questions/967332/how-can-i-install-cuda-9-on-ubuntu-17-10

关于ubuntu - ImportError : libcublas. so.9.0 : cannot open shared object file: No such file or directory (UBUNTU 16. 04),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49606548/

相关文章:

linux - 如何在 linux 中打开程序时运行 bash 脚本

Makefile 中的 C : Unix SDL2 library : undefined reference, 问题?

python-2.7 - Cassandra - ubuntu 16.04::无法启动 cassandra.service:找不到单元 cassandra.service

node.js - TypeError [ERR_UNESCAPED_CHARACTERS] 请求路径包含未转义字符

ubuntu - 在 Ubuntu 10.04 上为 odbc 编译 LuaSQL 2.1.1

macos - 在 Mac 上的 docker ubuntu 镜像上运行 apt-get update 会导致 "File has unexpected size"

python - ValueError : Failed to find data adapter that can handle input: <class 'NoneType' >, <class 'NoneType' > in keras model.predict

python - TensorFlow 中的一切都是 Tensor,包括操作吗?

python - ValueError:检查目标时出错:预期 main_prediction 有 3 个维度,但得到形状为 (1128, 1) 的数组

c++ - Cmake 如何知道 Ubuntu 系统上已安装的库?