anaconda已经支持m芯片了,所以直接在官网下载
创建conda环境
conda create -n tensorflow_learn python=3.8
conda activate tensorflow_learn
按照tensorflow
conda install -c apple tensorflow-deps==2.6.0
#确实python指向哪个虚拟环境的,可以用which python
# 不加镜像安装比较慢
python -m pip install tensorflow-macos #下载比较慢
# 如果下载不成功,就像加个景象源就好了,我下载这个时没加镜像下载就很快了
python -m pip install tensorflow-macos -i https://pypi.tuna.tsinghua.edu.cn/simple/
python -m pip install tensorflow-metal -i https://pypi.tuna.tsinghua.edu.cn/simple/
测试是否成功
python
import tensorflow as tf
print(tf.test.is_gpu_available())
如果出现numpy版本的异常,则先conda uninstall umpy,在安装
我现在的版本的1.24.3