Installation and verification of pytorch in linux or windows environment (solving runtimeerror problem)

Installation and verification of pytorch in linux or windows environment (solving runtimeerror problem)

1. Download the corresponding installation file from the pytorch official website

https://pytorch.org/

Select the corresponding version at getstarted

Method 1: Install directly using the corresponding installation instructions

But in fact, this is more likely to break or cause a runtimeout error. Solution: Use pip to search for the source first, stop downloading after it starts, then find the link printed on the screen, manually download whl and then install it manually.

Method 2: Select the corresponding version of whl for offline download

Find the download link

Download the whl file and install it

pytorch installs the specified version from the link

pip3 install whl
pip3 install torchvision

2. Verification

import torch
import torchvision
print(torch.cuda.is_available())#The output is true

3. Check the pytorch version

import torch
print(torch.__version__)

Summarize

The above is the installation and verification of pytorch in Linux or Windows environment introduced by the editor (solving the runtimeerror problem). I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • Solve the problem of out of memory during Pytorch training and testing
  • Solve the error problem encountered when Pytorch loads the trained model
  • Solution to RuntimeError: when testing neural network in Pytorch

<<:  CentOS7.x uninstall and install MySQL5.7 operation process and encoding format modification method

>>:  Usage and best practice guide for watch in Vue3

Recommend

Basic introductory tutorial on MySQL partition tables

Preface In a recent project, we need to save a la...

Summary of various methods of implementing article dividing line styles with CSS

This article summarizes various ways to implement...

MySQL database terminal - common operation command codes

Table of contents 1. Add users 2. Change the user...

How to create Apache image using Dockerfile

Table of contents 1. Docker Image 2. Create an in...

Example code of how CSS matches multiple classes

CSS matches multiple classes The following HTML t...

A brief discussion on the mysql execution process and sequence

Table of contents 1:mysql execution process 1.1: ...

Summary of MySQL LOAD_FILE() function method

In MySQL, the LOAD_FILE() function reads a file a...

Solution to index failure caused by MySQL implicit type conversion

Table of contents question Reproduction Implicit ...

A detailed introduction to Linux file permissions

The excellence of Linux lies in its multi-user, m...

Analysis of Mysql transaction characteristics and level principles

1. What is a transaction? A database transaction ...

In-depth exploration of whether Mysql fuzzy query is case-sensitive

Preface Recently, I have been busy writing a smal...

MySQL uses aggregate functions to query a single table

Aggregate functions Acts on a set of data and ret...

Pure CSS3 to achieve pet chicken example code

I have read a lot of knowledge and articles about...