Xiaobai zero basic entry version installation pytorch detailed explanation (non-mirror quick installation)

        As a novice, installing pytorch has entered a lot of pitfalls, and Tsinghua's mirror source cannot be used. Later, I tried offline installation. At first, I downloaded the offline installation package from Tsinghua’s mirror network. After installing it with the conda command, the caffe2_detectron_ops_gpu.dll module could not be loaded or lacked dependencies. (I checked this problem for a whole day and saw several problems, but because people use a Mac system, I feel even more uncomfortable) Finally, I went to the official website to download the corresponding version of the offline installation package, and then The installation was successful. The detailed steps are as follows:

1. Install the corresponding version of CUDA and CUDNN before installing the GPU version of pytorch

(For detailed installation, please refer to the reprinted article CUDA and CUDNN installation article https://blog.csdn.net/wobushizhainanyu/article/details/107736090

2. Go to the pytorch official website to find the corresponding version to be installed https://pytorch.org/

Copy the link at the back of the corresponding version, and open it in the browser

3. After opening the above link, find the corresponding version of the package to download torch and torchvision versions need to correspond, for example, my

4. Then open the command line cd to switch the directory to the location where the above two packages were downloaded, and then install it with pip. You must switch to your own python version environment, otherwise an error will occur. Don't forget Xiaobai!

 

5. Verify that pytorch is installed successfully, enter the following command, as shown in the figure below, it will be successful

Text copy:

1、import torch
2、torch.cuda.is_available()
输出——True
3、 device = torch.device("cuda:0" if(torch.cuda.is_available() and True > 0) else "cpu")
4、print(device)
输出——cuda:0
5、 print(torch.cuda.get_device_name(0))
输出——GeForce GTX 1050 Ti

Reprinted: https://blog.csdn.net/wobushizhainanyu/article/details/107778206

 

Code words are not easy, I hope everyone will give a lot of likes and attention, and will continue to update the content in the future, thank you all.

Guess you like

Origin blog.csdn.net/hacker_NO_007/article/details/107780699