undefined symbol:导入tensorflow时的cuDevicePrimaryCtxGetState

时间:2018-05-14 15:32:05

标签: python-2.7 tensorflow

大家好!

我正在尝试安装和运行tensorflow(GPU支持)。我按照指南安装了cudnn 7和cuda 9.0。

但是,在尝试导入tensorflow时,我收到以下错误:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/boudi/anaconda2/lib/python2.7/site-
packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow  # pylint: 
disable=unused-import
File "/home/boudi/anaconda2/lib/python2.7/site-
packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/boudi/anaconda2/lib/python2.7/site-
packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/boudi/anaconda2/lib/python2.7/site-
packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/boudi/anaconda2/lib/python2.7/site-
packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in 
<module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/boudi/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: /home/boudi/anaconda2/lib/python2.7/site-
packages/tensorflow/python/../libtensorflow_framework.so: undefined 
symbol: cuDevicePrimaryCtxGetState

我该如何解决?

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题-我已经在Ubuntu计算机上安装了必需的NVIDIA驱动程序,但是当我尝试导入Tensorflow时,我遇到了同样的错误。

所以对我来说,问题是我使用的是Nouveau驱动程序而不是NVIDIA驱动程序。为了解决此问题,您需要转到System Settings-> Software & Updates-> Additional Drivers并选择选项Using NVIDIA binary driver ...,然后单击Apply Changes按钮。然后重新启动就可以了。