在 Linux 虚拟环境中安装 numpy 时出现错误

问题描述 投票:0回答:1

我尝试使用命令

pip install numpy
在虚拟环境上安装 numpy,但出现此错误:

Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      + /home/pi/Desktop/programmazione/progetto_scuola/venv/bin/python /tmp/pip-install-fldv094j/numpy_4395b0f038e2421d8bc70daabbb62c35/vendored-meson/meson/meson.py setup /tmp/pip-install-fldv094j/numpy_4395b0f038e2421d8bc70daabbb62c35 /tmp/pip-install-fldv094j/numpy_4395b0f038e2421d8bc70daabbb62c35/.mesonpy-yro_0v0g/build -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/tmp/pip-install-fldv094j/numpy_4395b0f038e2421d8bc70daabbb62c35/.mesonpy-yro_0v0g/build/meson-python-native-file.ini
      The Meson build system
      Version: 1.2.99
      Source dir: /tmp/pip-install-fldv094j/numpy_4395b0f038e2421d8bc70daabbb62c35
      Build dir: /tmp/pip-install-fldv094j/numpy_4395b0f038e2421d8bc70daabbb62c35/.mesonpy-yro_0v0g/build
      Build type: native build
      Project name: NumPy
      Project version: 1.26.0
      
      ../../meson.build:1:0: ERROR: Compiler cc cannot compile programs.
      
      A full log can be found at /tmp/pip-install-fldv094j/numpy_4395b0f038e2421d8bc70daabbb62c35/.mesonpy-yro_0v0g/build/meson-logs/meson-log.txt
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

在出现此错误之前,我遇到了另一个错误:它报告 gcc 版本应该 >= 8.4,但通过更新 gcc 和发行版,我现在使用版本 8.10。 附:我使用的是基于 Debian 的发行版:Raspberry Pi OS。

python-3.x numpy virtualenv python-venv
1个回答
0
投票

现在我尝试输入此命令:

apt install build-essential
,现在我收到此错误:

 C compiler for the host machine: cc (gcc 10.2.1 "cc (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110")
      C linker for the host machine: cc ld.bfd 2.35.2
      C++ compiler for the host machine: c++ (gcc 10.2.1 "c++ (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110")
      C++ linker for the host machine: c++ ld.bfd 2.35.2
      Cython compiler for the host machine: cython (cython 3.0.3)
      Host machine cpu family: arm
      Host machine cpu: armv7l
      Program python found: YES (/home/pi/Desktop/programmazione/progetto_scuola/venv/bin/python)
      Found pkg-config: /usr/bin/pkg-config (0.29.2)
      Run-time dependency python found: YES 3.10
      Has header "Python.h" with dependency python-3.10: YES
      Compiler for C supports arguments -fno-strict-aliasing: YES
      Message: During parsing cpu-dispatch: The following CPU features were ignored due to platform incompatibility or lack of support:
      "XOP FMA4"
      Test features "NEON" : Supported
      Test features "NEON_FP16" : Supported
      Test features "NEON_VFPV4" : Supported
      Test features "ASIMD" : Unsupported due to Compiler fails against the test code of "ASIMD"
      Test features "ASIMDHP" : Unsupported due to Implied feature "ASIMD" is not supported
      Test features "ASIMDFHM" : Unsupported due to Implied feature "ASIMD" is not supported
      Configuring npy_cpu_dispatch_config.h using configuration
      Message:
      CPU Optimization Options
        baseline:
          Requested : min
          Enabled   :
        dispatch:
          Requested : max -xop -fma4
          Enabled   : NEON NEON_FP16 NEON_VFPV4
      
      Library m found: YES
      Found CMake: /usr/bin/cmake (3.16.3)
      DEPRECATION: CMake support for versions <3.17 is deprecated since Meson 0.62.0.
      |
      |   However, Meson was only able to find CMake 3.16.3.
      |
      |   Support for all CMake versions below 3.17.0 will be removed once
      |   newer CMake versions are more widely adopted. If you encounter
      |   any errors please try upgrading CMake to a newer version first.
      
      WARNING: CMake Toolchain: Failed to determine CMake compilers state
      Run-time dependency openblas found: NO (tried pkgconfig and cmake)
      Run-time dependency openblas found: NO (tried pkgconfig and cmake)
      
      ../../numpy/meson.build:207:4: ERROR: Problem encountered: No BLAS library detected! Install one, or use the `allow-noblas` build option (note, this may be up to 100x slower for some linear algebra operations).
© www.soinside.com 2019 - 2024. All rights reserved.