python如何安装PyTorch

先执行下面这行命令,看看自己电脑上安装的cuda版本是多少

nvcc --version

然后根据自己的cuda版本来安装对应版本的PyTorch,比如我的cuda版本号是12.4,那么我的下载链接就是:https://download.pytorch.org/whl/cu124(如果你的cuda版本是11.7,那么你的链接就是:https://download.pytorch.org/whl/cu117)

pip install torch torchvision torchaudio -i https://mirrors.aliyun.com/pypi/simple/ --extra-index-url https://download.pytorch.org/whl/cu124

安装成功后,可以使用下面这行命令查看PyTorch版本号

conda list torch

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: