【发布时间】:2017-06-04 10:25:45
【问题描述】:
我已经按照 NVIDIA(Ubuntu 16.04 Desktop,GTX 970)本教程中的说明逐步安装了 TensorFlow:
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-Toolkit 安装到 /opt/cuda/toolkit(也是 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
但错误仍然存在。谁能给我提示为什么会发生此错误? 非常感谢:)
【问题讨论】:
-
你安装的是什么版本的TensorFlow?可通过
python -c 'import tensorflow;print tensorflow.__version__'查询
标签: python ubuntu tensorflow