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

目录

问题描述

问题解决方法

报错关键字:

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系统的一种命令行安装方法(命令如下)之后,虽然问题没解决(因为库安装到了Python系统环境而不是虚拟环境),但是和另外一篇文章给了我启发,文章链接也附后

sudo apt-get install python3-scipy
  • 链接

SciPy - Installation

在 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的尾缀。

 真是玄学啊……

你可能感兴趣的:(编程错误,python,scipy,numpy)