-i https://pypi.douban.com/simple

-i https://pypi.tuna.tsinghua.edu.cn/simple

pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple ​​​​​​​

python3.6 torch1.2.0

pip install --user torch==1.2.0 -f https://download.pytorch.org/whl/torch_stable.html -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

 torch 1.10

pip3 install torch==1.10.1+cu113 torchvision==0.11.2+cu113 torchaudio===0.10.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html --default-timeout=1000

验证

import torch
torch.cuda.is_available()

显示为 True