【树莓派问题】树莓派python虚拟环境无法安装scipy库

文章描述了在安装scipy库时遇到的依赖安装失败问题,特别是numpy的安装。报错信息表明可能是版本不匹配或环境不兼容。作者尝试了修改镜像源、安装依赖等方法未果,最后通过降低scipy和numpy版本至1.6.0成功解决了问题,推测是高版本库与Python虚拟环境的兼容性问题。
摘要由CSDN通过智能技术生成

目录

报错关键字:

问题描述

解决方法


报错关键字:

Building wheel for numpy (PEP 517): started
Building wheel for numpy (PEP 517): still running...
pip subprocess to install backend dependencies did not run successfully.
This error originates from a subprocess, and is likely not a problem with pip
error: subprocess-exited-with-error

问题描述

        安装scipy库时,总是报错,大致意思是依赖安装失败,而且从报错内容(下图)可以看出来依赖应该是指numpy

 × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 2
  ╰─> [104 lines of output]
      Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple, https://www.piwheels.org/simple
      Ignoring numpy: markers 'python_version == "3.8" and platform_machine == "aarch64" and platform_python_implementation != "PyPy"' don't match your environment
      Ignoring numpy: markers 'python_version == "3.8" and platform_machine == "arm64" and platform_system == "Darwin"' don't match your environment
      Ignoring numpy: markers 'python_version == "3.9" and platform_machine == "arm64" and platform_system == "Darwin"' don't match your environment
      Ignoring numpy: markers 'platform_machine == "loongarch64"' don't match your environment
      Ignoring numpy: markers 'python_version == "3.10" and platform_system == "Windows" and platform_python_implementation != "PyPy"' don't match your environment
      Ignoring numpy: markers 'python_version == "3.8" and (platform_machine != "arm64" or platform_system != "Darwin") and platform_machine != "aarch64" and platform_machine != "loongarch64" and platform_python_implementation != "PyPy"' don't match your environment
      Ignoring numpy: markers 'python_version == "3.10" and (platform_system != "Windows" and platform_machine != "loongarch64") and platform_python_implementation != "PyPy"' don't match your environment
      Ignoring numpy: markers 'python_version == "3.11" and platform_python_implementation != "PyPy"' don't match your environment
      Ignoring numpy: markers 'python_version >= "3.12"' don't match your environment
      Ignoring numpy: markers 'python_version >= "3.8" and platform_python_implementation == "PyPy"' don't match your environment
      Collecting meson-python<0.13.0,>=0.11.0
        Using cached meson_python-0.12.1-py3-none-any.whl (66 kB)
      Collecting Cython<3.0,>=0.29.32
        Using cached https://www.piwheels.org/simple/cython/Cython-0.29.33-cp39-cp39-linux_armv7l.whl (5.0 MB)
      Collecting pybind11==2.10.1
        Using cached https://www.piwheels.org/simple/pybind11/pybind11-2.10.1-py3-none-any.whl (216 kB)
      Collecting pythran<0.13.0,>=0.12.0
        Using cached https://www.piwheels.org/simple/pythran/pythran-0.12.1-py3-none-any.whl (4.2 MB)
      Collecting wheel<0.39.0
        Using cached https://www.piwheels.org/simple/wheel/wheel-0.38.4-py3-none-any.whl (36 kB)
      Collecting numpy==1.19.5
        Downloading https://www.piwheels.org/simple/numpy/numpy-1.19.5-cp39-cp39-linux_armv7l.whl (10.5 MB)
           鈹佲攣鈹佲攣鈹\x81                                    1.4/10.5 MB 23.5 kB/s eta 0:06:28

        我尝试很多网上和我有相似问题的方法,包括但不限于,修改国内镜像源,命令行安装一些依赖,都没能解决。

        在尝试scipy官方推荐的在linux系统的一种命令行安装方法(命令如下1)之后,虽然问题没解决(因为库安装到了Python系统环境而不是虚拟环境),但是它和另外一篇文章2启发了我解决问题思路,文章链接也附在后面

  • 命令
sudo apt-get install python3-scipy
  • 链接

1 SciPy - Installation

2 在 VS 代码上安装 numpy 时出现“正在准备元数据 (pyproject.toml) ... 错误”答案 - 爱码网

解决方法

        我猜测是因为安装的库版本太高,Python虚拟环境的高版本库还不能兼容很好Linux系统之类的问题,证据如下图,下载的时候,尾缀感觉不对。

        因为在系统环境中使用sudo apt-get install python3-scipy安装的scipy是1.6.0版本,所以引起我的怀疑,因此我在虚拟环境中也安装了1.6.0的scipy结果成功了,后来我为了验证自己的想法,尝试了安装1.9.0和1.7.0,发现1.9.0和1.10的安装后缀相似,而与之不同,1.7.0和1.60的安装后缀相似,安装包后面有Linux的尾缀。

真是玄学啊……

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Desenberg

如果有帮助收藏点赞再走吧

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值