无法加载Tensorflow

时间:2018-04-02 00:55:10

标签: python linux python-2.7 tensorflow terminal

我使用pip安装了tensorflow(即使是不同版本的tf),但每当我在服务器中加载它时,我都会得到以下结果。我花了一整天的时间,到目前为止还无法弄明白。希望聪明的人能轻松做到!

> import tensorflow as tf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/afs/umich.edu/user/b/m/bmodene/miniconda2/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *  # pylint: disable=redefined-builtin
  File "/afs/umich.edu/user/b/m/bmodene/miniconda2/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/afs/umich.edu/user/b/m/bmodene/miniconda2/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/afs/umich.edu/user/b/m/bmodene/miniconda2/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/afs/umich.edu/user/b/m/bmodene/miniconda2/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/afs/umich.edu/user/b/m/bmodene/miniconda2/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: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.17' not found (required by /afs/umich.edu/user/b/m/bmodene/miniconda2/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so)

无法加载本机TensorFlow运行时。

我尝试按照以下说明操作:https://www.tensorflow.org/install/install_sources#common_installation_problems

1 个答案:

答案 0 :(得分:0)

在你所指的页面中,“构建pip包”下面有一节说:

  

关于gcc 5或更高版本的说明:TensorFlow网站上提供的二进制pip包是使用gcc 4构建的,它使用较旧的ABI。要使您的构建与旧的ABI兼容,您需要在您的bazel构建命令中添加--cxxopt =“ - D_GLIBCXX_USE_CXX11_ABI = 0”。 ABI兼容性允许针对TensorFlow pip包构建的自定义操作继续对您构建的包进行操作。

目前还不清楚你的问题是否自己构建了软件包,但是如果是的话,你试过这个选项吗?