ubuntu 16.04的import tensorflow错误“ImportError:没有名为pywrap_tensorflow_internal的模块”

时间:2017-06-26 21:10:48

标签: tensorflow

我无法调用tensorflow获得以下错误

    (TF) drx@drx:~$ python
    Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
    [GCC 5.4.0 20160609] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import tensorflow
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *
    File "tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
    File "tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
      raise ImportError(msg)
    ImportError: Traceback (most recent call last):
    File "tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
     from tensorflow.python.pywrap_tensorflow_internal import *
    ImportError: No module named pywrap_tensorflow_internal

    Failed to load the native TensorFlow runtime.

我的CUDA版本是

    (TF) drx@drx:~$ nvcc --version
    nvcc: NVIDIA (R) Cuda compiler driver
    Copyright (c) 2005-2016 NVIDIA Corporation
    Built on Tue_Jan_10_13:22:03_CST_2017
    Cuda compilation tools, release 8.0, V8.0.61`

我的cuDNN版本是

    #define CUDNN_MAJOR      5
    #define CUDNN_MINOR      1
    #define CUDNN_PATCHLEVEL 10

有人可以指导我解决问题吗?

1 个答案:

答案 0 :(得分:0)

此问题已得到解决。 tensorflow试图从不同的位置导入包。我已经通过命令卸载了tensorflow,然后删除了名为tensorflow的所有文件夹并重新安装了新版本。现在它工作正常。