在anaconda中的虚拟环境安装pytorch=1.11时候报错如下:
其他语句。。。
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
但是我按上述提示打开http://anaconda.org后找不到我想要的环境,所以这条路行不通。
之后按其他方法更新了.condarc文件中的内容,但是也会报如下错误:
Warning: 8 possible package resolutions (only showing differing packages): - https://repo.anaconda.com/pkgs/main/win-64/win-64::ca-certificates-2020.6.24-0,
https://repo.anaconda.com/pkgs/main/win-64/win-64::certifi-2020.6.20-py38_0,
https://repo.anaconda等等。。。
解决办法
第一步 按照清华镜像网站所给出的解决方案,设置.condarc文件里的内容如下:
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
deepmodeling: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/
第二步 在命令行运行如下语句来设置路径次序
conda update --strict-channel-priority --all
第三步 等更新完之后,到pytorch官网找到你想下载的包的语句,直接按照之前的方法安装。我安装pytorch1.11.0语句如下
conda install pytorch==1.11.0 torchvision==0.12.0 torchaudio==0.11.0 cudatoolkit=11.3 -c pytorch
安装成功!!!