The GPU version of pytorch is successfully installed but cannot use cuda

Install pytorch on the remote server and follow the official website commands. However, after completion, it shows that the GPU is unavailable, so this pitfall is recorded.

1. Install according to the official website

 Installation is quick, though! ! After the installation was completed, I entered the following code for installation verification but it showed that the installation was not successful! !

import torch # 如果pytorch安装成功即可导入
print(torch.cuda.is_available()) # 查看CUDA是否可用
print(torch.cuda.device_count()) # 查看可用的CUDA数量
print(torch.version.cuda) # 查看CUDA的版本号

So this indicates a big installation failure!

But not giving up, I entered the following statement to check the torch

conda list

This shows that we are installing only the CPU version! !

2. Solution

Because of this big pit, it can be said that a whole night was wasted. After learning from many blogs, the following blogger's blog can be said to be a super good solution.

pytorch cannot use cuda

Follow the guidance of this blog and use pip to successfully install the GPU version of torch.

It is hereby recorded

Guess you like

Origin blog.csdn.net/weixin_43959436/article/details/127560304