ERROR: Could not find a version that satisfies the requirement torch (from versions: none) ERROR: No matching distribution found for torch错误解决办法

相关官网:
pytorch官网https://pytorch.org/
清华大学开源软件镜像站https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/

1 问题

如果通过conda安装pytorch出现上述错误,如果你是出现了题目上面的错误,但是没有找到原因,可能是本文中遇到的Python版本的问题。
我是用conda默认安装python版本,默认给我安装的是最新版3.13,但是在清华大学镜像站中并没有python3.13的版本对应的pytorch,因此需要安装python3.12或者更低版本。
如果python版本太新就不会有相应的pytorch版本在镜像中,就会出现题目的错误提示

 ERROR: Could not find a version that satisfies the requirement torch (from versions: none)
 ERROR: No matching distribution found for torch错误解决办法

2 解决方法

  1. 查找是否存在版本对应的pytorch
    清华大学开源软件镜像站https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
    在这里插入图片描述
    进入win-64/后搜索cuda12.4版本
    在这里插入图片描述
  2. 删除环境
conda remove -n 环境名 --all
  1. 创建环境
conda create -n 环境名 python=版本号

注意:python版本号得是有对应的pytorch,否则出现错误

  1. 去pytorch官网找安装方法,根据自己的电脑环境安装
    pytorch官网https://pytorch.org/

例如代码如下:

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124

在这里插入图片描述

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐