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

Solution to 404 Problem of Tomcat Installation in Docker

Find the containerID of tomcat and enter the toma...

Solution to interface deformation when setting frameset height

Currently I have made a project, the interface is ...

How complicated is the priority of CSS styles?

Last night, I was looking at an interview question...

Detailed explanation of vue page state persistence

Table of contents Code: Replenish: Summarize Requ...

In-depth explanation of Mysql deadlock viewing and deadlock removal

Preface I encountered a Mysql deadlock problem so...

How to Find the Execution Time of a Command or Process in Linux

On Unix-like systems, you may know when a command...

Implementing image fragmentation loading function based on HTML code

Today we will implement a fragmented image loadin...

Html makes a simple and beautiful login page

Let’s take a look first. HTML source code: XML/HT...

Web page custom selection box Select

Everyone may be familiar with the select drop-dow...

20 Signposts on the Road to Becoming an Excellent UI (User Interface) Designer

Introduction: Interface designer Joshua Porter pub...

React+Amap obtains latitude and longitude in real time and locates the address

Table of contents 1. Initialize the map 2. Map Po...

MySQL character types are case sensitive

By default, MySQL character types are not case-se...

A detailed analysis of the murder caused by a misplaced double quote in MySQL

1. Introduction Recently, I often encounter devel...