通过pip安装torch


在线安装:
安装cpu版:
安装1.9.0
pip install torch1.9.0+cpu torchvision0.10.0+cpu torchaudio0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
安装1.7.0
pip install torch
1.7.0+cpu torchvision0.8.1+cpu torchaudio=0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
安装gpu版:
pip install torch1.9.0+cu111 torchvision0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html

离线安装:

安装gpu版(python3.8, windows环境):
先下载:
https://download.pytorch.org/whl/cu111/torch-1.9.1%2Bcu111-cp38-cp38-win_amd64.whl
https://download.pytorch.org/whl/cu111/torchvision-0.10.0%2Bcu111-cp38-cp38-win_amd64.whl
再通过pip安装

查看是否安装成功:
import torch
print(torch.version)
print(torch.cuda.is_available())
参考:
https://blog.csdn.net/qq_37541097/article/details/117993519

cuda和torch版本对应关系:https://www.csdn.net/tags/NtjaYgzsMjgzOTAtYmxvZwO0O0OO0O0O.html


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM