安装requirements.txt报错

从Github上下了一份代码,其中requirements.txt的内容如下:

matplotlib==3.1.1
numpy==1.17.4
pandas==0.25.3
scipy==1.4.1
scikit_learn==0.23.10
torch==1.7.0

我想要通过pip安装requirements.txt,但是总是出各种错误,费个牛劲终于搞好了,我把报的错和解决办法都列出来了,供以后参考,如下:

错误1:

ERROR: Could not find a version that satisfies the requirement scikit-learn==0.23.10 (from versions: 0.9, 0.10, 0.11, 0.12, 0.12.1, 0.13, 0.13.1, 0.14, 0.14.1, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.16.1, 0.17, 0.17.1, 0.18, 0.18.1, 0.18.2, 0.19.0, 0.19.1, 0.19.2, 0.20.0, 0.20.1, 0.20.2, 0.20.3, 0.20.4, 0.21.0, 0.21.1, 0.21.2, 0.21.3, 0.22, 0.22.1, 0.22.2, 0.22.2.post1, 0.23.0, 0.23.1, 0.23.2, 0.24.0, 0.24.1, 0.24.2, 1.0, 1.0.1, 1.0.2)
ERROR: No matching distribution found for scikit-learn==0.23.10

shift,这个问题出在版本号不匹配,作者在requirements文件中写的scikit-learn版本号是0.23.10,问题就在于最后多了一个0!正确的版本号是0.23.1!

错误2

ERROR: Could not find a version that satisfies the requirement scikit-learn==0.23.1 (from versions: none)
ERROR: No matching distribution found for scikit-learn==0.23.1

咱就是说,版本号对了吧,怎么又出错了呢?这时候我意识到,可能是因为我还在开着代理,安装包的时候一定要把vpn关掉呀!然后加上清华源单独安装:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple scikit-learn==0.23.1,成功!划重点:安装包前关闭代理,遇到from version:none的错误就加镜像源。

错误3

安装到torch的时候又出幺蛾子了,于是我就单独安装torch,结果又报错:

ERROR: torch has an invalid wheel, torch has an invalid wheel, .dist-info directory not found

意思是轮子无效,我想可能是因为没有指定torch的版本,于是改用指令pip install torch\==1.7.0+cpu torchvision\==0.8.1+cpu torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
安装,一下就成功了,所以在安装torch的时候一定要指定安装cpu版本的还是GPU版本的!

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值