pytorch installation and torch.cuda.is_available() is false

Install pytorchcpu version

Download Anaconda first
, enter
conda create -n your_env_name python=XX under the anaconda prompt
and enter
Insert picture description here

Insert picture description here
Verification:
Insert picture description here
pip install pandas matplotlib notebook -i http://pypi.doubanio.com/simple
Use this command to install the required packages

Insert picture description here
Quick install notebook

When using the pip install torch torchvision command to download and feel very slow,
click here to
download the corresponding torch and torchvision,
where the CPU is the CPU version;
cu100 is the CUDA10.0 version and the
cp38 is the python3.8 version

After downloading, use cd and other commands to jump to the path where the whl file is downloaded; through pip install torch+tab (auto-completion function), torchvision is the same, through pip install torchvision+tab.
Note: Be sure to pay attention to version issues Does not correspond to error-prone
Finally, use the python
import torch torch
torch.cuda.is_available() of the console
if it is true, it proves that the installation is successful and you can use it.
If it is false, the reason is mostly the wrong version, it is recommended to reinstall.

Guess you like

Origin blog.csdn.net/HenryFanQAQ/article/details/111247062