在ubuntu上安装tensorf流的问题

时间:2017-04-26 12:44:59

标签: python tensorflow cuda

我在Linux上安装了tensorflow,但是当我尝试在python shell中导入它时,它无法找到模块。我在tensorflow网站上找不到错误按摩。有没有人对我如何解决它有任何想法?

每当我发出命令时:

import tensorflow as tf

我得到了回报:

Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
  File "/home/beheerder/anaconda2/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "/home/beheerder/anaconda2/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 51, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/home/beheerder/anaconda2/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/home/beheerder/anaconda2/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/beheerder/anaconda2/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/beheerder/anaconda2/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: libcublas.so.8.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.

2 个答案:

答案 0 :(得分:1)

通过你的错误似乎你正在使用anaconda来进行张量流动。我有这个错误,似乎anoroda的tensorflow-gpu仍在开发中,并且无法正常工作。

我建议你在anaconda环境中安装tensorflow-gpu版本。 cpu版本工作正常。

在没有anacoda for python 2.7的情况下再次安装后再次安装。 DO:

cd /opt/DL/tensorflow/bin/
source tensorflow-activate

跟随this,因为它类似

答案 1 :(得分:0)

看起来它无法找到你的Cuda图书馆。你想检查的事情是:

  • 你真的有GPU吗?如果不是:重新安装非GPU张量流
  • 你有Cuda 8.0版吗?在您使用旧版本之前,但是从Tensorflow 1.0版本开始,您必须至少拥有版本8.也许重新安装Cuda来解决此问题。
祝你好运!