当前位置:   article > 正文

ERROR: No matching distribution found for torch==1.2.0 解决方法

no matching distribution found for torch

一、环境

系统环境:Windows10
Python版本:Python3.6.0
IDE:Pycharm、Spyder

二、问题

今天用 pip 安装torch,安装方式如下:

pip install torch==1.2.0  -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
  • 1

出现了如下错误:

ERROR:Could not find a version that satisfies the requirement torch1.2.0
ERROR:No matching distribution found for torch
1.2.0

三、解决方法

关于"Could not find a version that satisfies…"这类问题,网上说的比较多的主要有这么几种方法:

1、更新pip

python -m pip install --upgrade pip

2、用国内的镜像源来加速网络

pip install 包名 -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
其中 --trusted-host pypi.douban.com 是为了获得 SSL 证书的认证。

3. 最终解决

以上方法都试了,然而都没有效果…

恰在此时,不经意间看见一篇文章 Windows 上报错:Could not find a version that satisfies the requirement torch==0.4.1

与我所碰到的问题很类似!于是借鉴这位网友的做法,用 pip 命令从 Pytorch 官网下载指定的版本:

https://www.jianshu.com/p/f54a01419330?utm_campaign=haruki

pip install torch==1.2.0 -f https://download.pytorch.org/whl/torch_stable.html
  • 1

但一波刚平,一波又起,这时又报了另一个错:Could not install packages due to an EnvironmentError:[WinError 5] Permission denied
这是由于权限不够,于是将指令改为 pip install --user torch==1.3.0 -f https://download.pytorch.org/whl/torch_stable.html 即可。

当然,也可使用镜像源加速下载,相应的命令为:

pip install --user torch==1.3.0 -f https://download.pytorch.org/whl/torch_stable.html -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com。
  • 1

最后成功安装~

pip install --user torch==1.2.0 -f https://download.pytorch.org/whl/torch_stable.html -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
  • 1
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/代码探险家/article/detail/756252
推荐阅读
相关标签
  

闽ICP备14008679号