【发布时间】:2021-06-23 14:37:49
【问题描述】:
我很难在 MacBook Pro 上安装 tensorflow。
最初,我在虚拟环境中尝试了pip3.8 install tensorflow。它已安装,但当我尝试使用它时出现以下错误:
This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
我知道这是一个警告,但我认为这是一个严重的警告,我将在任何不重要的工作中遇到性能问题。
根据这篇文章 (Tensorflow on MacOS: Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA),我卸载了 tensorflow 并按照步骤操作。安装 Bazel 后,使用自制软件,运行 ./configure 时出现错误:
请将您的 Bazel 安装降级到版本 0.26.1。
据此:(https://github.com/bazelbuild/bazel/releases) 最旧的版本是 3.2。我安装了 3.7。所以我使用自制软件卸载了 Bazel。尽管从源代码编译似乎是正确的方法,但这感觉就像一条死胡同。它要求的那个版本甚至与当前版本相差甚远。我认为该消息没有告诉我我需要知道什么。
接下来我尝试使用 pip 安装 Tensorflow.org 推荐的版本。 (https://www.tensorflow.org/install/pip.html)
pip3.8 install https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-2.4.0-cp38-cp38-macosx_10_14_x86_64.whl
这也成功安装,但给我的错误与我的原始安装类似,并且未通过 tensorflow.org 页面上安装列表中推荐的测试。
我认为我犯了一个新手错误。有人可以帮忙吗?
【问题讨论】:
-
这不是一个严重的警告,你完全反应过度了。
-
我刚才做了类似的事情。在 tensorflow 目录中运行
bazel --version现在告诉我如何安装让我正确编译 tensorflow 的旧 bazel 可执行文件。之后我能够关注您链接的网站。唯一对我不起作用的是,不需要卸载 protobuf,所以我必须再次pip install protobuf才能完成编译。
标签: python macos tensorflow