The whole process of installing pytorch under Ubuntu 16.04

Pytorch's official website address

At present, the latest version of Pytorch version is 1.4, supporting the latest cuda9.2 and 10.1
according to its own CUDA version, you can choose the appropriate Pytorch version
(Must choose to adapt to the CUDA version of your own computer or server, otherwise you will make an error!)
Click the red letter install previous versions of PyTorch in the picture below,
which is this URL: https://pytorch.org/get-started/previous-versions/
Insert picture description here
See the following interface:
Insert picture description here
select the corresponding version command as needed.
Here I installed based on CUDA9.0 and Anaconda, so the selected command is:

conda install pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=9.0 

Note that "-c pytorch" is deleted here. The pre-configured domestic mirror source will be used, and the download speed will be much faster. The specific configuration method is very simple, but I will repeat it.
Insert picture description here
After the installation is complete, enter:

python

Enter the python environment of anaconda
Insert picture description here
and enter:

import torch
import torchvision
print(torch.__version__)
print(torchvision.__version__)

Get the following display,
Insert picture description here
you can enter again:

print(torch.cuda.is_available())

Display: True

The installation is complete!

Published 2 original articles · won 0 · views 12

Guess you like

Origin blog.csdn.net/Jaredzzz/article/details/105589094