1. 安装 Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2. Miniforge
https://github.com/conda-forge/miniforge
bash Miniforge3-MacOSX-arm64.sh
3. 创建虚拟环境
conda create -n tensorflow python=3.9.5
conda activate tensorflow
4. 安装tensorflow
# pip install --force-reinstall numpy==1.20.2
# python -m pip uninstall tensorflow-macos
# python -m pip uninstall tensorflow-metal
## Upgrade tensorflow-deps
# conda install -c apple tensorflow-deps --force-reinstall
conda install -c apple tensorflow-deps
python -m pip install tensorflow-macos
python -m pip install tensorflow-metal
brew install libjpeg
python -m pip install matplotlib
tensorflow 2.0 Demo
import random
import tensorflow