首先,我们默认已经安装了conda。第一步就是安装TensorFlow在Apple上面的依赖。
conda install -c apple tensorflow-deps -y
第二步是安装TensorFlow-macOS。
python -m pip install tensorflow-macos
如果你网速不够可以使用清华源。
python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow-macos
第三步是安装TensorFlow-Metal。
python -m pip install tensorflow-metal
如果你网速不够可以使用清华源。
python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow-metal
这样子TensorFlow就成功安装在了m1芯片的MacBook Pro上了。
然后就可以开心地在m1芯片上训练模型了。