安装pytorch
首先安装好CUDA和CUDNN,这个比较简单,参考:这里
然后在官网上找对应的版本链接: torch.
这时可以选conda或者pip,也就引出了坑1.
conda安装失败
总是提示Solving environment: failed with initial frozen solve. Retrying with flexible solve.
采用了更换镜像链接,升级conda平台,翻墙等手段都不行。
pip安装
pip安装与conda安装的区别,点开看看?
出先了Memory报错,一长串红字。
这时需要添加"-no-cache-dir":在安装时指示不启用缓存即可
pip install --no-cache-dir torch==..........
验证
import torch
x = torch.rand(5,3)
print(x)
torch.cuda.is_available()