问题:
torch.cuda.is_available()
false
解决:
1 查gpu型号
2 装驱动
3 建立虚拟环境(已建立忽略)
conda create -n m39 python=3.9
4 手动下载轮子
https://download.pytorch.org/whl/torch_stable.html
找对应版本下载
5 安装
pip install "E:\torch-1.12.1+cu116-cp39-cp39-win_amd64.whl"
pip install "E:\torchaudio-0.12.1+cu116-cp39-cp39-win_amd64.whl"
pip install "E:\torchvision-0.13.1+cu116-cp39-cp39-win_amd64.whl"
6 验证
(m39) C:\Users\83489>python
Python 3.9.0 (default, Nov 15 2020, 08:30:55) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda.is_available()
True
>>> exit()