我正在尝试在 Odroid C2 上安装 Tensorflow 0.8.0。C2 使用 64 位 ARM 处理器并在 Ubuntu 16.04 上运行 Python 2.7 和 3.5,所以我希望事情会很简单,因为我相信这些都得到支持。从我极差的理解来看,似乎有很多不同的软件不相信该板是 64 位的。
$ uname -i
aarch64
$ cat /proc/cpuinfo
Processor : AArch64 Processor rev 4 (aarch64)
按照 tensorflow 网站https://www.tensorflow.org/versions/r0.8/get_started/os_setup.html上的安装说明进行操作
经过一轮 apt-get 更新、升级和安装依赖,然后下载 Python 2.7 Linux 64bit 版本的 Anaconda:
$ bash Anaconda2-4.0.0-Linux-x86_64.sh
WARNING:
Your operating system appears not to be 64-bit, but you are trying to
install a 64-bit version of Anaconda2.
Are sure you want to continue the installation? [yes|no]
继续进行时,安装最终崩溃
installing: conda-env-2.4.5-py27_0 ...
Anaconda2-4.0.0-Linux-x86_64.sh: line 461: /home/odroid/anaconda2/pkgs/python-2.7.11-0/bin/python: cannot execute binary file: Exec format error
ERROR:
cannot execute native linux-64 binary, output from 'uname -a' is:
Linux top-master 3.14.29-56 #1 SMP PREEMPT Wed Apr 20 12:15:54 BRT 2016 aarch64 aarch64 aarch64 GNU/Linux
我继续前进,尝试了基于 pip 的安装。
$ sudo pip3 install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp34-cp34m-linux_x86_64.whl
tensorflow-0.8.0-cp34-cp34m-linux_x86_64.whl is not a supported wheel on this platform.
(python 2.7 的 pip 也会出现同样的问题)
我见过一些类似的问题,尽管“不支持轮子”,但一些文件重命名技巧可以解决问题。重命名后,我可以安装 tensorflow:
$ sudo pip3 install tensorflow-0.8.0-cp35-none-any.whl
Processing ./tensorflow-0.8.0-cp35-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): protobuf==3.0.0b2 in / usr/local/lib/python3.5/dist-packages (from tensorflow==0.8.0)
Requirement already satisfied (use --upgrade to upgrade): six>=1.10.0 in /usr/li b/python3/dist-packages (from tensorflow==0.8.0)
Requirement already satisfied (use --upgrade to upgrade): wheel>=0.26 in /usr/li b/python3/dist-packages (from tensorflow==0.8.0)
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.8.2 in /usr/l ib/python3/dist-packages (from tensorflow==0.8.0)
Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/lib /python3/dist-packages (from protobuf==3.0.0b2->tensorflow==0.8.0)
Installing collected packages: tensorflow
Successfully installed tensorflow-0.8.0
然而,在:
$ python3
Python 3.5.1+ (default, Mar 30 2016, 22:46:26)
[GCC 5.3.1 20160330] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
我得到:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/tensorflow/__init__.py", line 23, in <module>
from tensorflow.python import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/__init__.py", line 45, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
File "/usr/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /usr/local/lib/python3.5/dist-packages/tensorflow/python/_pywrap_tensorflow.so: cannot open shared object file: No such file or directory
重要的是,我注意到这个文件确实存在:
$ ls /usr/local/lib/python3.5/dist-packages/tensorflow/python
client __init__.py lib platform pywrap_tensorflow.py summary user_ops
framework kernel_tests ops __pycache__ _pywrap_tensorflow.so training util
和以前一样,对 Python 2.7 重复相同的步骤会导致相同的问题(文件夹略有不同)。我不太确定如何进一步解决这个问题——我想下一步是尝试构建自己的张量流,但如果可以避免,那就太好了。