Table of Contents
Find
Official website https://pytorch.org/ get-started/locally/#windows-verification also explains the verification method:
ImportError: numpy.core.multiarray failed to import
Copy after login
Copy after login
" >
ImportError: numpy.core.multiarray failed to import
Copy after login
Copy after login
This blog is mainly introduced in AnacondaCreate the
Find Anaconda Prompt in
Install PyTorch in a virtual environment
import torch
Copy after login
Copy after login
" >
import torch
Copy after login
Copy after login
Home Backend Development Python Tutorial Detailed explanation of PyTorch installation guide

Detailed explanation of PyTorch installation guide

Nov 24, 2020 pm 04:32 PM

##python video tutorialColumn introduces the installation guide of PyTorch

Detailed explanation of PyTorch installation guide

##Related free learning recommendations:
python video tutorial

This blog mainly introduces the creation of the
PyTorch

environment in the Anaconda virtual environment. The Anaconda software has been successfully installed by default.

Anaconda Inpidual Edition

official download link:https://www.anaconda.com/products/inpidual

According to your own operating system , select the required version number, and then install it in a fool-proof manner. For specific installation and use, please refer to the following link:

https://blog.csdn.net/ITLearnHall/article/details/81708148

Create a virtual environment for PyTorch

Find

Anaconda Prompt

in [Recently Added] and open it, enter the following commands in sequence: <div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false"># 创建名为 PyTorch_envs 的虚拟环境,并指定 Python 版本号为 python 3.8 conda create -n PyTorch_envs python=3.8 # 激活虚拟环境 PyTorch_envs conda activate PyTorch_envs # 退出虚拟环境 conda deactivate</pre><div class="contentsignin">Copy after login</div></div><div class="contentsignin">Copy after login</div></div>

Install PyTorch in the virtual environment

Open the

PyTorch

official website and choose to install. [Here we choose the official website installation method. Bloggers have also tried other installation methods, but the results are not very good, so it is best to follow the official website installation method. After all, wool comes from the sheep.

Follow the instructions on the official website to install Detailed explanation of PyTorch installation guidePyTorch
. What needs to be noted here is that you must know your CUDA version number before installation, here You can refer to the link https://blog.csdn.net/qq_38295511/article/details/89223169

## My own

CUDADetailed explanation of PyTorch installation guide version number It is
10.1, so choose as shown in the picture. It is recommended to choose the pip

installation method. The operating system should be selected according to your own operating system. I will not go into details here. [It is best to choose a relatively good network environment] If the download speed is very slow, it is recommended to change the source installation. Pay attention to specify the version number. For the specific source change method, please refer to:

https://blog.csdn. net/Ginomica_xyx/article/details/109605629

Detailed explanation of PyTorch installation guideVerify whether PyTorch is installed successfully

Official website https://pytorch.org/ get-started/locally/#windows-verification also explains the verification method:

Detailed explanation of PyTorch installation guide As shown in the figure,
PyTorchDetailed explanation of PyTorch installation guide was installed successfully.
Possible problems during the installation process

import torch
Copy after login
Copy after login
Occurrence

ImportError: numpy.core.multiarray failed to import
Copy after login
Copy after login

Cause of error: There is a problem with the version of

numpy

, resulting in the inability to communicate with

PyTorch The version is matched, specifically the numpy version is too low. Solution: Upgrade the version of numpy

. After activating the environment, enter the following command:

conda upgrade numpy
Copy after login
Copy after login
End.

##PyTorch Installation Guide

This blog is mainly introduced in AnacondaCreate the

PyTorch

environment in the virtual environment, and the Anaconda software has been successfully installed by default. Anaconda Inpidual Edition official download link:

https://www.anaconda.com/products/inpidualAccording to your own operating system , select the required version number, and then install it in a fool-proof manner. For specific installation and use, please refer to the following link:

https://blog.csdn.net/ITLearnHall/article/details/81708148

Create a virtual environment for PyTorch

Find Anaconda Prompt in

[Recently Added]

and open it, enter the following commands in sequence: <div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false"># 创建名为 PyTorch_envs 的虚拟环境,并指定 Python 版本号为 python 3.8 conda create -n PyTorch_envs python=3.8 # 激活虚拟环境 PyTorch_envs conda activate PyTorch_envs # 退出虚拟环境 conda deactivate</pre><div class="contentsignin">Copy after login</div></div><div class="contentsignin">Copy after login</div></div>

Install PyTorch in a virtual environment

Open the PyTorch official website and select installation. [Here we choose the official website installation method. Bloggers have also tried other installation methods, but the results are not very good, so it is best to follow the official website installation method. After all, wool comes from the sheep.

Detailed explanation of PyTorch installation guide
Follow the instructions on the official website to install PyTorch. What needs to be noted here is that you must know your CUDA version number before installation, here You can refer to the link

https://blog.csdn.net/qq_38295511/article/details/89223169

Detailed explanation of PyTorch installation guide## My own
CUDA version number It is 10.1, so choose as shown in the picture.

It is recommended to choose the

pip installation method. The operating system should be selected according to your own operating system. I will not go into details here. [It is best to choose a relatively good network environment] If the download speed is very slow, it is recommended to change the source installation. Pay attention to specify the version number. For the specific source change method, please refer to:

https://blog.csdn. net/Ginomica_xyx/article/details/109605629

Detailed explanation of PyTorch installation guide

Verify whether PyTorch is installed successfully

Official website https://pytorch.org/ get-started/locally/#windows-verification also explains the verification method:

Detailed explanation of PyTorch installation guide
Detailed explanation of PyTorch installation guide As shown in the figure,
PyTorch was installed successfully.

Possible problems during the installation process

import torch
Copy after login
Copy after login

Occurrence

ImportError: numpy.core.multiarray failed to import
Copy after login
Copy after login

Cause of error: There is a problem with the version of

numpy, resulting in the inability to communicate with PyTorch The version is matched, specifically the numpy version is too low.

Solution: Upgrade the version of

numpy. After activating the environment, enter the following command:

conda upgrade numpy
Copy after login
Copy after login
End.

The above is the detailed content of Detailed explanation of PyTorch installation guide. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to solve the permissions problem encountered when viewing Python version in Linux terminal? How to solve the permissions problem encountered when viewing Python version in Linux terminal? Apr 01, 2025 pm 05:09 PM

Solution to permission issues when viewing Python version in Linux terminal When you try to view Python version in Linux terminal, enter python...

How to efficiently copy the entire column of one DataFrame into another DataFrame with different structures in Python? How to efficiently copy the entire column of one DataFrame into another DataFrame with different structures in Python? Apr 01, 2025 pm 11:15 PM

When using Python's pandas library, how to copy whole columns between two DataFrames with different structures is a common problem. Suppose we have two Dats...

How to teach computer novice programming basics in project and problem-driven methods within 10 hours? How to teach computer novice programming basics in project and problem-driven methods within 10 hours? Apr 02, 2025 am 07:18 AM

How to teach computer novice programming basics within 10 hours? If you only have 10 hours to teach computer novice some programming knowledge, what would you choose to teach...

What are regular expressions? What are regular expressions? Mar 20, 2025 pm 06:25 PM

Regular expressions are powerful tools for pattern matching and text manipulation in programming, enhancing efficiency in text processing across various applications.

How to avoid being detected by the browser when using Fiddler Everywhere for man-in-the-middle reading? How to avoid being detected by the browser when using Fiddler Everywhere for man-in-the-middle reading? Apr 02, 2025 am 07:15 AM

How to avoid being detected when using FiddlerEverywhere for man-in-the-middle readings When you use FiddlerEverywhere...

How does Uvicorn continuously listen for HTTP requests without serving_forever()? How does Uvicorn continuously listen for HTTP requests without serving_forever()? Apr 01, 2025 pm 10:51 PM

How does Uvicorn continuously listen for HTTP requests? Uvicorn is a lightweight web server based on ASGI. One of its core functions is to listen for HTTP requests and proceed...

What are some popular Python libraries and their uses? What are some popular Python libraries and their uses? Mar 21, 2025 pm 06:46 PM

The article discusses popular Python libraries like NumPy, Pandas, Matplotlib, Scikit-learn, TensorFlow, Django, Flask, and Requests, detailing their uses in scientific computing, data analysis, visualization, machine learning, web development, and H

How to dynamically create an object through a string and call its methods in Python? How to dynamically create an object through a string and call its methods in Python? Apr 01, 2025 pm 11:18 PM

In Python, how to dynamically create an object through a string and call its methods? This is a common programming requirement, especially if it needs to be configured or run...

See all articles