通過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