准备工作
1.官网
2.下载步骤
1).点DOWNLODE
2).下载社区版
3).NEXT==>选路径==>NEXT==>NEXT(全打勾)==>Finish
4).打卡之前创建好的环境文件夹
右键,由PyCharm打开
5).添加环境
6).软件测试
新建一个.py文件,右键环境文件夹==>NEW==>python.file
import torch
a = torch.cuda.is_available()
print(a)
ngpu= 1
device = torch.device("cuda:0" if (torch.cuda.is_available() and ngpu > 0) else "cpu")
print(device)
print(torch.cuda.get_device_name(0))
print(torch.rand(3,3).cuda())
至此环境搭建结束
遇到的问题
1.ERROR: torch-1.11.0+cu113-cp310-cp310-win_amd64.whl is not a supported wheel on thisrm. platfo
2.UserWarning: Failed to initialize NumPy: No module named numpy
3.总结
1).显示torch问题就下载离线的安装.whl文件,手动安装
2).显示numpy的问题就下载官网的你需要的版本CUDA包