Solve similar problems like could not find a version that satisfies the requirement torch

According to the literal meaning of the error, it means that the corresponding version was not found

Obviously, it was copied from the official website to execute the command, and I went to its whl download URL: https://download.pytorch.org/whl/torch_stable.html   and found that there is indeed a corresponding version.

Personally, I think it should be a network problem. Pip downloads and installs the corresponding library. In essence, it should also download whl, so I feel that the network is not good, so I didn't find it.

1. First check whether there is a corresponding wheel library under pip list.

If not, go to the link above to find the corresponding wheel file.

Note: You need to download according to your python version. For example, mine is version 3.6, so I choose cp36-cp36m, otherwise the next error will prompt you that this whl is not applicable to this platform, the same is true for torchvision.

2. Install directly using the wheel file

Install torch first, then install torchvision, otherwise an error will be reported. Take the command to install torch as an example. CMD enters the directory where the whl of your torch is stored, and then executes the following command.

pip install torch-1.3.0+cu92-cp36-cp36m-win_amd64.whl -i https://pypi.tuna.tsinghua.edu.cn/simple/
pip install torchvision-0.4.1-cp36-cp36m-win_amd64.whl -i https://pypi.tuna.tsinghua.edu.cn/simple/

 Here I used the command to temporarily change the download source of Tsinghua University, because although the whl of torch has been downloaded here, it may have to download other libraries, so downloading from domestic sources will still be much faster.

The installation in the figure below does not add a temporary mirror source, which is relatively slow! ! !

Summary: This method can be said to be not only suitable for the installation of torch, but also any other library. When encountering a situation that cannot be downloaded directly, you can also try to download its whl, and then go through whl Install the corresponding library.

Method Two:

Mandatory installation

For example: if you install torch, if you can't find the version, run:

pip install torch==1.4.0 -f https://download.pytorch.org/whl/torch_stable.html

 

Guess you like

Origin blog.csdn.net/MasterCayman/article/details/110195332