我尝试从 pip 安装:
pip3 install --user --no-cache https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.0-cp36-cp36m-linux_x86_64.whl
然后尝试导入并得到:
Using TensorFlow backend.
/usr/lib64/python3.6/importlib/_bootstrap.py:205: RuntimeWarning:
compiletime version 3.5 of module
'tensorflow.python.framework.fast_tensor_util' does not match runtime
version 3.6
return f(*args, **kwds)
2017-11-10 09:35:01.206112: I
tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports
instructions that this TensorFlow binary was not compiled to use: SSE4.1
SSE4.2 AVX
问题:
我不明白为什么车轮显示 3.6,但我收到了关于 3.5 的警告
我想编译以优化我的 cpu,那么我可以使用 pip 从源安装而不是从二进制轮安装吗?
最佳答案
RuntimeWarning: compiletime version 3.5 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.6
这是 known issue ,得到prioritized并且可能很快就会修复。现在的解决方法是使用 python 3.5。
更新:
问题 has been fixed在每晚的 tensorflow 构建中:“tf-nightly
和 tf-nightly-gpu
现在有一个为 Linux 从头构建的 python3.6 二进制文件。”
即,以下命令应该适用于 python 3.6:
# tf-nightly or tf-nightly-gpu
pip3 install tf-nightly
Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX
这个警告是因为默认的 tensorflow 发行版是编译的,没有 CPU 扩展支持(更多关于这个 here)。如果您想获得 CPU 优化的 tensorflow 包,您唯一的选择是 build it yourself .这有 pip 乏味,但绝对可行。该构建将生成 wheel 文件,您可以使用它来安装它
pip3 install /path/to/the/tensorflow.whl
但是,如果您只是想抑制警告,则可以这样做:
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
关于python - Tensorflow 安装失败,出现 "compiletime version 3.5 of module does not match runtime version 3.6",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47225210/