1. 编译前先安装依赖:

xcode 9.2或者更高

使用 brew包管理工具安装python

brew install python



TensorFlow源码编译(MacOS)_Powered by 金山文档



TensorFlow源码编译(MacOS)_Powered by 金山文档_02


安装依赖:

pip install -U --user pip numpy wheel packaging requests opt_einsum



TensorFlow源码编译(MacOS)_Powered by 金山文档_03


pip install -U --user keras_preprocessing --no-deps



TensorFlow源码编译(MacOS)_git_04


brew install bazelisk 配置时会自动安装bazel5.3.0版本



TensorFlow源码编译(MacOS)_tensorflow_05


克隆TensorFlow源码:

git clone https://github.com/tensorflow/tensorflow.git



TensorFlow源码编译(MacOS)_python_06


配置:



TensorFlow源码编译(MacOS)_git_07


编译源码:



TensorFlow源码编译(MacOS)_tensorflow_08



TensorFlow源码编译(MacOS)_macos_09


Bug解决中...