2017-04-26 48 views
0

我在Linux上安裝tensorflow,但是當我嘗試在python shell中導入它時,找不到模塊。我無法在tensorflow網站上找到錯誤消息。有沒有人對我如何修復它有任何想法?在ubuntu上安裝tensorf流程的問題

每當我發出命令:

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. 
+0

請註明設備是否是GPU/CPU和安裝tensorflow的方式。 – shahin

回答

0

看起來它無法找到您的Cuda的庫。要檢查的事情是:

  • 你真的有GPU?如果沒有:重新安裝非GPU tensorflow
  • 你有Cuda版本8.0嗎?在使用舊版本之前,但自Tensorflow 1.0發佈以來,您至少必須擁有版本8.可能需要重新安裝Cuda來解決此問題。

祝你好運!

1

通過你的錯誤似乎你正在使用anaconda爲你tensorflow。我有這個錯誤,看起來anacoda的tensorflow-gpu仍在開發中,並且不能正常工作。

我建議你在anaconda環境中安裝tensorflow-gpu版本。 CPU版本雖然工作正常。

乾淨安裝後,沒有爲python 2.7 aacoda。 DO:

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

按照this,因爲它是類似