install tensorflow from sources for MacOS
运行tensorflow时经常遇到如下问题:
The TensorFlow library wasn’t compiled to use SSE4.1/SSE4.2 /AVX/AVX2/FMA instructions, but these are available on your machine and could speed up CPU computations
于是好奇就想尝试通过tensorflow源码安装解决这个问题
先说一下我的电脑系统版本:macOS sierra version 10.12.6 不带独显所以我装的是cpu版本的tensorflow
下面就是叙述一下安装步骤和我在安装过程中遇到的一些问题:
1. 先把tensorflow源码下载(clone the tensorflow repository)
$ git clone https://github.com/tensorflow/tensorflow
$ cd tensorflow
$ git checkout Branch # where Branch is the desired branch
2. 配置环境(prepare environment for MacOS)
在安装tensorflow之前,必须先安装bazel和python依赖包(six numpy wheel)
利用homebrew安装bazel,先安装JDK 8和homebrew, 这两个我很早就安装了就不叙述了
利用brew安装bazel如下:
brew install bazel
bazel version
brew upgrade bazel
install python dependencies