解决在Anaconda虚拟环境中安装包出错

文章描述了在Anaconda的虚拟环境中安装PyTorch1.11时遇到的错误,包括找不到所需包和包解析警告。作者尝试了从anaconda.org搜索无果后,选择了更新.condarc文件并设置清华镜像源。经过调整conda的渠道优先级并执行更新,最终成功安装了PyTorch1.11,同时提供了安装命令示例。
摘要由CSDN通过智能技术生成

在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

 安装成功!!!

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值