Conda环境python2.7 TensorFlow导入错误

时间:2020-06-02 04:53:39

标签: python tensorflow conda

我只需要使用python2.7。我遵循this的答案,并使用

安装了tensorflow
conda install -c conda-forge tensorflow

之后,当我导入tensorflow时,我得到以下错误堆栈跟踪

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-67f8173eef8c> in <module>()
      1 # Workspace problem with several narrow gaps
      2 
----> 3 import tensorflow as tf
      4 import numpy as np
      5 import matplotlib.pyplot as plt

/home/ultrainstinct/.local/lib/python2.7/site-packages/tensorflow/__init__.py in <module>()
     22 
     23 # pylint: disable=g-bad-import-order
---> 24 from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
     25 
     26 try:

/home/ultrainstinct/.local/lib/python2.7/site-packages/tensorflow/python/__init__.py in <module>()
     47 import numpy as np
     48 
---> 49 from tensorflow.python import pywrap_tensorflow
     50 
     51 from tensorflow.python.tools import component_api_helper

/home/ultrainstinct/.local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py in <module>()
     72 for some common reasons and solutions.  Include the entire stack trace
     73 above this error message when asking for help.""" % traceback.format_exc()
---> 74   raise ImportError(msg)
     75 
     76 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long

ImportError: Traceback (most recent call last):
  File "/home/ultrainstinct/.local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/ultrainstinct/.local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/ultrainstinct/.local/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/ultrainstinct/.local/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: invalid ELF header


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

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

我去了上面提到的站点,但是没有发现与此错误有关的任何东西。

该如何解决?

1 个答案:

答案 0 :(得分:0)

尝试一下,可能会有所帮助:conda install -c https://conda.anaconda.org/jjhelmus tensorflow