最近搭环境下载torch和torchvision时验证失败报:
print(torch.cuda.is_available())
False
经过我的多方查找资料找到了解决方式:
1.如果已经存在 torch和torchvison包需要先卸载
查看已安装包:
pip list |grep torch
卸载:
pip uninstall ****
2.依次输入下列命令进行安装即可
pip install https://download.pytorch.org/whl/cu100/torch-1.1.0-cp37-cp37m-linux_x86_64.whl
pip install https://download.pytorch.org/whl/cu100/torchvision-0.3.0-cp37-cp37m-linux_x86_64.whl
验证代码
import torch
print(torch.__version__)
print(torch.cuda.is_available())
print(torch.cuda.get_device_name(0))