完全解决“Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA”警告

问题描述

在使用TensorFlow时,老是提醒“Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA”
在这里插入图片描述python

解决办法

网上有不少说在python代码中添加:
os.environ[“TF_CPP_MIN_LOG_LEVEL”]=‘2’ # 只显示 warning 和 Error
来忽略警告linux


可是这样无疑使治标不治本,只是掩耳盗铃罢了git


根本方法:出现这样的问题是咱们的TensorFlow版本出现问题了,所以要换成支持cpu用AVX2编译的TensorFlow版本github

  1. 首先,卸载原先的版本错误的TensorFlow:
    pip3 uninstall tensorflow
    P.S. 若是是python2版本请使用pip uninstall tensorflow
    在这里插入图片描述
  2. 安装正确版本的TensorFlow
    github上有不少TensorFlow的版本可供下载,Windows系统下载地址其余系统下载地址
    根据readme文件找到适合本身的TensorFlow版本
    在这里插入图片描述
    由于个人开发环境是Ubuntu18.04+python3.6,因此选择这个版本
    下载至本地
    安装:sudo pip3 install tensorflow-1.9.0-cp36-cp36m-linux_x86_64.whl
    (注意使用sudo权限)
    在这里插入图片描述

大功告成,这样就不会再看到没法编译的警告,完全解决问题啦~~~web