【问题标题】:Error when importing tensorflow on raspberry pi 2在树莓派 2 上导入 tensorflow 时出错
【发布时间】:2017-06-23 03:06:49
【问题描述】:

在我的树莓派上从源安装 tensorflow 后,导入 tensorflow 会出现以下错误:

import tensorflow
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "/usr/lib/python3.4/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
ImportError: /usr/local/lib/python3.4/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so: wrong ELF class: ELFCLASS64

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.4/dist-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "/usr/lib/python3.4/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
ImportError: /usr/local/lib/python3.4/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so: wrong ELF class: ELFCLASS64

顺便说一句,我是在 python 3.4 上的树莓派 2 上从官方 tensorflow 网站安装的。 我卸载了包括 numpy 在内的所有 tensorflow 依赖项并安装了。这安装了所有依赖项,但花了大约一个小时。它还说:

Could not find .egg-info directory in install record for numpy>=1.11.0 (from tensorflow==1.2.0)

和:

 Could not find .egg-info directory in install record for protobuf

然后在导入tensorflow的时候,它给了我第一个错误。

【问题讨论】:

    标签: python numpy tensorflow raspberry-pi


    【解决方案1】:

    您的错误_pywrap_tensorflow_internal.so: wrong ELF class: ELFCLASS64 表示您正在尝试将 64 位代码加载到 32 位进程中。
    你有什么操作系统? 这个guy 成功在树莓派 2 上安装了 tensorflow。 你也可以试试this package
    请注意,运行 Raspberry 2 并不是一项简单的任务。你用的是哪个官方的 tensorflow 网站?
    至于 egg-info 警告,请尝试使用pip install --upgrade setuptools pip 升级 setuptools。

    【讨论】:

      猜你喜欢
      • 2017-09-29
      • 2013-12-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-06-11
      相关资源
      最近更新 更多