之前我已经在 Python 2.7 的 Ubuntu 16.04 上从源代码安装了 tensorflow,并且运行良好。
对于 Python 3.5(我创建了一个新的 anaconda 环境),我安装了其中一个二进制版本,但我收到了警告消息。
编辑,使用下载的二进制轮,我收到的消息是...
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:910] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
...而且代码运行速度似乎比我使用 native 编译的 py27 运行要慢得多。
因此,我卸载了“旧的”tensorflow 二进制文件(用于 py35),并按照 the Tensorflow Install from Sources page 中的说明进行了操作。 ,安装所有包,运行 ./configure,将其指向正确版本的 python(~/anaconda2/envs/py35/bin/python,及其相应的库路径),选择我的 CUDA 选项,一路向下到最后,构建中没有错误...
在最后一步,它告诉我它“不是这个平台上受支持的轮子”——你是说我刚刚构建的平台?
$ ./configure
...
$ bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
...
$ bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
Thu Mar 9 23:17:35 CST 2017 : === Using tmpdir: /tmp/tmp.RrsUxPKxFg
~/tmp/tensorflow/bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles ~/tmp/tensorflow
~/tmp/tensorflow
/tmp/tmp.RrsUxPKxFg ~/tmp/tensorflow
Thu Mar 9 23:17:36 CST 2017 : === Building wheel
~/tmp/tensorflow
Thu Mar 9 23:17:45 CST 2017 : === Output wheel file is in: /tmp/tensorflow_pkg
$ sudo -H pip install /tmp/tensorflow_pkg/tensorflow-1.0.1-cp35-cp35m-linux_x86_64.whl
tensorflow-1.0.1-cp35-cp35m-linux_x86_64.whl is not a supported wheel on this platform.
这里有一些检查...
$ python --version
Python 3.5.3 :: Continuum Analytics, Inc.
$ which python
/home/myusername/anaconda2/envs/py35/bin/python
$ which pip
/home/myusername/anaconda2/envs/py35/bin/pip
$ pip install --upgrade pip
Requirement already up-to-date: pip in /home/myusername/anaconda2/envs/py35/lib/python3.5/site-packages
$
有人可以提供建议吗?
我看过各种关于问题的帖子。 “not a supported wheel”,人们使用下载的与正确版本的 python 不匹配的二进制轮子(例如 cp34 vs cp35),以及关于在 Windows 上从源代码安装的帖子,但没有看到像我这样的帖子:involved installing从源代码开始,在 Linux 上正确“匹配”Python 版本。检查了 tensorflow 的 Github 问题,也没有看到这个。
最佳答案
这个错误是运行sudo -H pip install ...
安装编译好的PIP包引起的。 Anaconda 使用虚拟环境,它会覆盖 pip
可执行文件的路径。但是,sudo
命令 does not preserve the user's $PATH
environment variable ,所以 sudo -H pip install ...
将使用系统安装的 pip
,在本例中对应于不同版本的 Python。
幸运的是,如果您使用的是 Anaconda,则无需使用 sudo
来运行 pip
,因为整个环境都存储在您的用户拥有的目录中。
关于python - Tensorflow py3.5 从源代码 : "not a supported wheel"? 安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42711014/