2017-01-19 186 views
2

我已經安裝了TensorFlow一步一步像NVIDIA(Ubuntu的16.04桌面,GTX 970)在本教程中描述:Tensorflow與CUDA:導入錯誤

http://www.nvidia.com/object/gpu-accelerated-applications-tensorflow-installation.html

每個步驟完成時沒有錯誤,但如果我嘗試在Python進口TensorFlow事後我一直在剛開了此錯誤消息:

>>> import tensorflow as tf 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 24, in <module> 
    from tensorflow.python import * 
    File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 72, in <module> 
    raise ImportError(msg) 
ImportError: Traceback (most recent call last): 
    File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 61, in <module> 
    from tensorflow.python import pywrap_tensorflow 
    File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module> 
    _pywrap_tensorflow = swig_import_helper() 
    File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper 
    _mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description) 
ImportError: libcudart.so.8.0: cannot open shared object file: No such file or directory 


Failed to load the native TensorFlow runtime. 

See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error 

for some common reasons and solutions. Include the entire stack trace 
above this error message when asking for help. 

我已經安裝了支持CUDA工具包到/ opt/CUDA /工具包(也cuDNN)。 我已經嘗試過的符號鏈接:

sudo ln -s /opt/cuda-toolkit /usr/local/cuda 
sudo ln -s /opt/cuda-toolkit /usr/local/cuda-8.0 

或者這樣:

sudo export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/cuda-toolkit/lib64:/opt/cuda-toolkit/extras/CUPTI/lib64 
sudo export CUDA_HOME=/opt/cuda-toolkit 

但仍然是錯誤。任何人都可以給我一個提示,爲什麼會出現這種錯誤? 非常感謝:)

+0

你安裝了什麼版本的TensorFlow?可以用'python -c'import tensorflow查詢;打印tensorflow .__ version __'' – keveman

回答

4

我有類似的硬件(GTX 970米)的計算機上類似的問題,我解決它使用在下面的帖子中提供的步驟: https://askubuntu.com/a/278840

在我的情況下,唯一的區別是在nvidia.conf文件我添加只以下行: /usr/local/cuda-8.0/lib64

然後跑去:須藤LDCONFIG

希望它能幫助:)

+0

就是這樣:D非常感謝! – user7436888