python - Tensorflow 安装失败,出现 "compiletime version 3.5 of module does not match runtime version 3.6"

标签 python linux python-3.x tensorflow pip

我尝试从 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

问题:

  1. 我不明白为什么车轮显示 3.6,但我收到了关于 3.5 的警告

  2. 我想编译以优化我的 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-nightlytf-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/

相关文章:

python - 如何将更新的DataFrame实时输入到sql或db中

python - Pandas 中的 join 和 merge 有什么区别?

python - 如何根据 Pandas 另一列中的条件计算记录的频率?

linux - 如何在 GNU/Linux 上的目录树中搜索文件

yocto 中的交叉编译库配方

c - DDD 替代方案,它也绘制了数据结构的漂亮图片

python - Python 2 的选择器等效吗?

python - 将类标签附加到 Keras 模型

Python - 文件读取需要帮助

python - Pandas Dataframe 过滤器包含 ('.' ),Python 3.6