一、引言
在 Windows 下使用 vscode 的命令行安装 pytorch 时经常卡在 98%。
二、解决
具体原因没一直尝试,最终解决方法就是:
打开 Windows Power Shell(管理员),然后打开 VPN 再安装。
下面是我使用的命令,安装带有 cuda 的 pytorch。
1
conda install pytorch==2.5.1 torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
三、其他
在 conda 中添加其他镜像
1
2
3
4
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
conda config --set show_channel_urls yes