M1 Mac環境でTensorFlowを使う


M1 MacでTensorFlow環境を構築するには、Anacondaを利用するのが簡単です

Anaconda Individual Editionをインストール

Apple Developerサイトそのままの情報ですが、

miniforge3環境をダウンロードする

$ wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh
$ chmod a+x Miniforge3-MacOSX-arm64.sh
$ . Miniforge3-MacOSX-arm64.sh

miniforge3環境を起動する

$ source ~/miniforge3/bin/activate

Tensorflow関係のツールをインストールする

$ conda install -c apple tensorflow-deps
$ python -m pip install tensorflow-macos
$ python -m pip install tensorflow-metal

おわり