1

当我尝试在 linux 中安装 tensorflow 时出现以下错误。

我想在 linux 上安装 tensorflow。我不喜欢使用 virtualenv。

https://www.tensorflow.org/install/install_linux

有人知道安装 tensorflow 的正确推荐顺序是什么吗?谢谢。

$ pip install --upgrade tensorflow 
Requirement already up-to-date: tensorflow in /home/py/.linuxbrew/lib/python2.7/site-packages
Requirement already up-to-date: mock>=2.0.0 in /home/py/.linuxbrew/lib/python2.7/site-packages (from tensorflow)
Requirement already up-to-date: tensorflow-tensorboard<0.5.0,>=0.4.0rc1 in /home/py/.linuxbrew/lib/python2.7/site-packages (from tensorflow)
Requirement already up-to-date: backports.weakref>=1.0rc1 in /home/py/.linuxbrew/lib/python2.7/site-packages (from tensorflow)
Requirement already up-to-date: wheel in /home/py/.linuxbrew/lib/python2.7/site-packages (from tensorflow)
Requirement already up-to-date: numpy>=1.12.1 in /home/py/.linuxbrew/lib/python2.7/site-packages (from tensorflow)
Collecting protobuf>=3.3.0 (from tensorflow)
  Using cached protobuf-3.5.1-py2.py3-none-any.whl
Requirement already up-to-date: six>=1.10.0 in /home/py/.linuxbrew/lib/python2.7/site-packages (from tensorflow)
Requirement already up-to-date: enum34>=1.1.6 in /home/py/.linuxbrew/lib/python2.7/site-packages (from tensorflow)
Requirement already up-to-date: funcsigs>=1; python_version < "3.3" in /home/py/.linuxbrew/lib/python2.7/site-packages (from mock>=2.0.0->tensorflow)
Requirement already up-to-date: pbr>=0.11 in /home/py/.linuxbrew/lib/python2.7/site-packages (from mock>=2.0.0->tensorflow)
Requirement already up-to-date: bleach==1.5.0 in /home/py/.linuxbrew/lib/python2.7/site-packages (from tensorflow-tensorboard<0.5.0,>=0.4.0rc1->tensorflow)
Requirement already up-to-date: futures>=3.1.1; python_version < "3.2" in /home/py/.linuxbrew/lib/python2.7/site-packages (from tensorflow-tensorboard<0.5.0,>=0.4.0rc1->tensorflow)
Collecting markdown>=2.6.8 (from tensorflow-tensorboard<0.5.0,>=0.4.0rc1->tensorflow)
Requirement already up-to-date: html5lib==0.9999999 in /home/py/.linuxbrew/lib/python2.7/site-packages (from tensorflow-tensorboard<0.5.0,>=0.4.0rc1->tensorflow)
Collecting werkzeug>=0.11.10 (from tensorflow-tensorboard<0.5.0,>=0.4.0rc1->tensorflow)
  Using cached Werkzeug-0.13-py2.py3-none-any.whl
Collecting setuptools (from protobuf>=3.3.0->tensorflow)
  Using cached setuptools-38.2.5-py2.py3-none-any.whl
Installing collected packages: setuptools, protobuf, markdown, werkzeug
  Found existing installation: setuptools 38.2.4
    Uninstalling setuptools-38.2.4:
      Successfully uninstalled setuptools-38.2.4
  Found existing installation: protobuf 3.5.0.post1
    Uninstalling protobuf-3.5.0.post1:
      Successfully uninstalled protobuf-3.5.0.post1
  Found existing installation: Markdown 2.6.9
    Uninstalling Markdown-2.6.9:
      Successfully uninstalled Markdown-2.6.9
  Found existing installation: Werkzeug 0.12.2
    Uninstalling Werkzeug-0.12.2:
      Successfully uninstalled Werkzeug-0.12.2
Successfully installed markdown-2.6.10 protobuf-3.5.1 setuptools-38.2.5 werkzeug-0.13
$ python
Python 2.7.12 (default, Feb  3 2017, 09:33:51) 
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/py/.linuxbrew/Cellar/python/2.7.12_3/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "/home/py/.linuxbrew/Cellar/python/2.7.12_3/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/home/py/.linuxbrew/Cellar/python/2.7.12_3/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 72, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/home/py/.linuxbrew/Cellar/python/2.7.12_3/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/py/.linuxbrew/Cellar/python/2.7.12_3/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/py/.linuxbrew/Cellar/python/2.7.12_3/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/py/.linuxbrew/Cellar/python/2.7.12_3/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/install_sources#common_installation_problems

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

0 回答 0