升级
conda update -n base conda
换源国内源(最好科学上网,国内的源好像没有最新版的
清华的
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
中科大的
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/
显示目前的源
conda config --show-sources
恢复成原来的源
conda config --remove-key channels
下载pytorch
进官网,选择配置后
如果不能科学上网,改成国内源(-c pytorch要删掉,,因为它表示从官网进行下载)
例如:
conda install pytorch torchvision cudatoolkit=10.2
下载本地包
把包放到anaconda中 \Lib\site-packages 这个文件夹中(如果是虚拟环境,在env中找你的虚拟环境,再找\Lib\site-packages这个文件夹
然后(这里以pytorch-1.5.0-py3.6_cuda102_cudnn7_0.tar.bz2为例)
conda install --use-local pytorch-1.5.0-py3.6_cuda102_cudnn7_0.tar.bz2
如果你的安装包是xxx.tar,你可以看一下文件类型,如果有bz2,麻烦加上去
或者切换到目录下,再下载
本文介绍如何更换Anaconda的默认源为国内源,包括清华和中科大的镜像,以加速软件包的下载。同时,详细说明了如何通过Anaconda安装PyTorch及其依赖,包括使用官网配置或国内源,以及如何手动安装本地包。
1652

被折叠的 条评论
为什么被折叠?



