赞
踩
macbook m芯片使用的是Arm架构,目前m1芯片适配的加速后端是mps,其本事存在操作系统中,故只需下载对应版本的pytorch即可。
在pytorch官网上可以得到下载命令
你可以创建新的环境conda create -n new_env python=3.10
激活环境conda activate new_env
也可以使用自己原本的环境
查看当前环境conda env list
激活环境source activate 环境名
在mac终端输入pip3 install torch torchvision torchaudio
检查是否安装成功
python
import torch
torch.__version__
torch.device("mps")
出现问题:FileNotFoundError: [Errno 2] No such file or directory: ‘c:\programfiles\anaconda3\envs\py37\lib\site-packages\h5py-2.10.0.dist-info\METADATA’
出现的可能是因为环境移植出现的异常情况。
在你对应的路径中....anaconda3\\envs\\py37\\lib\\site-packages
中将已经存在的torch*文件去除,使用rm -r torch*
。
之后回到你的环境路径中:重新使用pip3 install torch torchvision torchaudio
即可
【1】【MacOS】MacBook使用本机m1芯片GPU训练的方法(mps替代cuda)
【2】Mac配置PyTorch完整版教程(M1芯片)
【3】python anaconda安装包错误之FileNotFoundError: [Errno 2] No such file or directory: …dist-info\METADATA
【4】anaconda 创建虚拟环境、激活及使用的基本方法
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。