Python安装Scipy报错解决方法指南

目录

  • 发现问题
  • 解决办法
  • 发现问题

    在一台window电脑中,按照scipy的时候,提示报错安装不成功。
    报错信息

    Preparing metadata (pyproject.toml) did not run successfully.
      │ exit code: 1
      ╰─> [21 lines of output]
          + meson setup --prefix=C:\Program Files (x86)\Python38 C:\Users\Administrator\AppData\Local\Temp\pip-install-l1dn1mu0\scipy_c74650cdd2bb47418cbd20a1ee6e1b49 C:\Users\Administrator\AppData\Local\Temp\pip-install-l1dn1mu0\scipy_c74650cdd2bb47418cbd20a1ee6e1b49\.mesonpy-8w2ewgkg\build --native-file=C:\Users\Administrator\AppData\Local\Temp\pip-install-l1dn1mu0\scipy_c74650cdd2bb47418cbd20a1ee6e1b49\.mesonpy-native-file.ini -Ddebug=false -Doptimization=2
          The Meson build system
          Version: 1.6.0
          Source dir: C:\Users\Administrator\AppData\Local\Temp\pip-install-l1dn1mu0\scipy_c74650cdd2bb47418cbd20a1ee6e1b49
          Build dir: C:\Users\Administrator\AppData\Local\Temp\pip-install-l1dn1mu0\scipy_c74650cdd2bb47418cbd20a1ee6e1b49\.mesonpy-8w2ewgkg\build
          Build type: native build
          Project name: SciPy
          Project version: 1.10.1
          WARNING: Failed to activate VS environment: Could not parse vswhere.exe output
    
          ..\..\meson.build:1:0: ERROR: Unknown compiler(s): [['icl'], ['cl'], ['cc'], ['gcc'], ['clang'], ['clang-cl'], ['pgcc']]
          The following exception(s) were encountered:
          Running `icl ""` gave "[WinError 2] 系统找不到指定的文件。"
          Running `cl /?` gave "[WinError 2] 系统找不到指定的文件。"
          Running `cc --version` gave "[WinError 2] 系统找不到指定的文件。"
          Running `gcc --version` gave "[WinError 2] 系统找不到指定的文件。"
          Running `clang --version` gave "[WinError 2] 系统找不到指定的文件。"
          Running `clang-cl /?` gave "[WinError 2] 系统找不到指定的文件。"
          Running `pgcc --version` gave "[WinError 2] 系统找不到指定的文件。"
    
          A full log can be found at C:\Users\Administrator\AppData\Local\Temp\pip-install-l1dn1mu0\scipy_c74650cdd2bb47418cbd20a1ee6e1b49\.mesonpy-8w2ewgkg\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.
    

    报错信息提示是我电脑上没有c的编辑环境,一些Scipy的功能需要C编译器。在Windows操作系统上,我们可以使用Microsoft Visual C++ Build Tools来安装C编译器。
    为了避免麻烦 可以直接通过下面指令直接安装

    解决办法

    电脑上安装有numpy 和matplotlib包,并更新到最新版。
    更新命令 pip install --upgrade numpy matplotlib

    pip install scipy --only-binary :all:
    

    作者:linxue110

    物联沃分享整理
    物联沃-IOTWORD物联网 » Python安装Scipy报错解决方法指南

    发表回复