树莓派python中安装numpy,pandas,torch,torchvision失败,ERROR: Could not find a version that satisfies the req

树莓派python中安装numpy,pandas,torch,torchvision问题

安装失败现象

python通过pip安装torch错误ERROR: Could not find a version that satisfies the requirement torch
其他库也类似上述报错

pip命令安装上述库失败原因

树莓派基于arm6架构,因此直接用pip命令安装各种库的时候,会默认安装linux_x86或aarch64版本的库,导致出现版本无法匹配问题。

解决

从连接中下载对应armv7l版本的库,然后放到树莓派中安装,进入whl所在文件夹,执行下边命令。至于是cp37,cp38还是cp39,可以都下载试一试哪一个版本可用。本人树莓派4b,python3.7.3使用的numpy,pandas,torch,torchvision都是cp37版本,如图所示。(以下给出多个连接防止丢失连接)

pip install numpy-1.21.4-cp37-cp37m-liux_armv7l.whl

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
貌似只有第一和第二个有armv7l的包,剩下两个连接没有。当然你也可以去github找,不过github上的arm7l库都是零零散散的。
官网链接:链接: https://www.piwheels.org/simple/
链接: https://torch.kmtea.eu/whl/stable.html
链接: https://download.pytorch.org/whl/torch_stable.html
链接: https://pypi.tuna.tsinghua.edu.cn/simple/
github连接
链接: https://github.com/nmilosev/pytorch-arm-builds
链接: https://github.com/Kashu7100/pytorch-armv7l

注意

如果先安装pandas,torch,torchvision完成后导入运行的话,一般都会报错numpy版本问题,然后提示你更新numpy,这时候别直接命令行更新哈,就去上边连接下载numpy的armv7l包,然后放到树莓派里手动安装,然后再导入pandas,torch,torchvision的armv7l的包就没事了。
总之就是最好先装numpy的armv7l,再装其他库的armv7l,就不会报错。

你可能感兴趣的:(python,pytorch,深度学习)