无法在Windows上使用pip安装Scipy

sr4lhrrt  于 2022-12-23  发布在  Windows
关注(0)|答案(3)|浏览(851)

我有一台Windows电脑,我尝试在命令提示符下使用pip安装SciPy。pip install ...适用于我安装的其他软件包;然而,对于scipy,它给了我一个错误。任何帮助都是很好的,下面是错误信息:

C:\Users\mharvest>pip install scipy
Collecting scipy
  Using cached scipy-1.9.1.tar.gz (42.0 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [55 lines of output]
      The Meson build system
      Version: 0.62.2
      Source dir: C:\Users\mharvest\AppData\Local\Temp\pip-install-jvemq8sw\scipy_46a2c46b25884e73b044795d4031c57c
      Build dir: C:\Users\mharvest\AppData\Local\Temp\pip-install-jvemq8sw\scipy_46a2c46b25884e73b044795d4031c57c\.mesonpy-ouof6i1j\build
      Build type: native build
      Project name: SciPy
      Project version: 1.9.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] The system cannot find the file specified"
      Running "cl /?" gave "[WinError 2] The system cannot find the file specified"
      Running "cc --version" gave "[WinError 2] The system cannot find the file specified"
      Running "gcc --version" gave "[WinError 2] The system cannot find the file specified"
      Running "clang --version" gave "[WinError 2] The system cannot find the file specified"
      Running "clang-cl /?" gave "[WinError 2] The system cannot find the file specified"
      Running "pgcc --version" gave "[WinError 2] The system cannot find the file specified"

      A full log can be found at C:\Users\mharvest\AppData\Local\Temp\pip-install-jvemq8sw\scipy_46a2c46b25884e73b044795d4031c57c\.mesonpy-ouof6i1j\build\meson-logs\meson-log.txt
      + meson setup --native-file=C:\Users\mharvest\AppData\Local\Temp\pip-install-jvemq8sw\scipy_46a2c46b25884e73b044795d4031c57c\.mesonpy-native-file.ini -Ddebug=false -Doptimization=2 --prefix=C:\Users\mharvest\AppData\Local\Programs\Python\Python311-32 C:\Users\mharvest\AppData\Local\Temp\pip-install-jvemq8sw\scipy_46a2c46b25884e73b044795d4031c57c C:\Users\mharvest\AppData\Local\Temp\pip-install-jvemq8sw\scipy_46a2c46b25884e73b044795d4031c57c\.mesonpy-ouof6i1j\build
      Traceback (most recent call last):
        File "C:\Users\mharvest\AppData\Local\Programs\Python\Python311-32\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 363, in <module>
          main()
        File "C:\Users\mharvest\AppData\Local\Programs\Python\Python311-32\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\mharvest\AppData\Local\Programs\Python\Python311-32\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\mharvest\AppData\Local\Temp\pip-build-env-bjmh2uho\overlay\Lib\site-packages\mesonpy\__init__.py", line 923, in get_requires_for_build_wheel
          with _project(config_settings) as project:
        File "C:\Users\mharvest\AppData\Local\Programs\Python\Python311-32\Lib\contextlib.py", line 137, in __enter__
          return next(self.gen)
                 ^^^^^^^^^^^^^^
        File "C:\Users\mharvest\AppData\Local\Temp\pip-build-env-bjmh2uho\overlay\Lib\site-packages\mesonpy\__init__.py", line 902, in _project
          with Project.with_temp_working_dir(
        File "C:\Users\mharvest\AppData\Local\Programs\Python\Python311-32\Lib\contextlib.py", line 137, in __enter__
          return next(self.gen)
                 ^^^^^^^^^^^^^^
        File "C:\Users\mharvest\AppData\Local\Temp\pip-build-env-bjmh2uho\overlay\Lib\site-packages\mesonpy\__init__.py", line 547, in with_temp_working_dir
          yield cls(source_dir, tmpdir, build_dir)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\mharvest\AppData\Local\Temp\pip-build-env-bjmh2uho\overlay\Lib\site-packages\mesonpy\__init__.py", line 463, in __init__
          self._configure(reconfigure=bool(build_dir) and not native_file_mismatch)
        File "C:\Users\mharvest\AppData\Local\Temp\pip-build-env-bjmh2uho\overlay\Lib\site-packages\mesonpy\__init__.py", line 494, in _configure
          self._meson(
        File "C:\Users\mharvest\AppData\Local\Temp\pip-build-env-bjmh2uho\overlay\Lib\site-packages\mesonpy\__init__.py", line 477, in _meson
          return self._proc('meson', *args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\mharvest\AppData\Local\Temp\pip-build-env-bjmh2uho\overlay\Lib\site-packages\mesonpy\__init__.py", line 472, in _proc
          subprocess.check_call(list(args))
        File "C:\Users\mharvest\AppData\Local\Programs\Python\Python311-32\Lib\subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['meson', 'setup', '--native-file=C:\\Users\\mharvest\\AppData\\Local\\Temp\\pip-install-jvemq8sw\\scipy_46a2c46b25884e73b044795d4031c57c\\.mesonpy-native-file.ini', '-Ddebug=false', '-Doptimization=2', '--prefix=C:\\Users\\mharvest\\AppData\\Local\\Programs\\Python\\Python311-32', 'C:\\Users\\mharvest\\AppData\\Local\\Temp\\pip-install-jvemq8sw\\scipy_46a2c46b25884e73b044795d4031c57c', 'C:\\Users\\mharvest\\AppData\\Local\\Temp\\pip-install-jvemq8sw\\scipy_46a2c46b25884e73b044795d4031c57c\\.mesonpy-ouof6i1j\\build']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

注意:此错误源于子进程,可能不是pip的问题。

3pvhb19x

3pvhb19x1#

从回溯判断,您似乎使用的是32位Python3.11
scipy-1.9.2没有32位的wheel,1.9.1有32位的wheel,但不针对Python 3.11。
安装64位Python解释器应该可以解决这个问题。虽然Python3.11还没有发布,但是您可以在https://www.python.org/downloads/release/python-3110rc2/找到64位安装程序

thigvfpy

thigvfpy2#

安装scipy 1.8.1版本它解决了我的问题安装它,如果你得到“不应该为使用PEP 517的scipy构建轮子,不能直接安装”错误.升级管道

bvn4nwqk

bvn4nwqk3#

错误消息的重要部分是ERROR: Unknown compiler(s),它通知我们没有找到C编译器:

..\..\meson.build:1:0: ERROR: Unknown compiler(s): [['icl'], ['cl'], ['cc'], ['gcc'], ['clang'], ['clang-cl'], ['pgcc']]

在修复这个问题之后,还需要一个C++编译器、一个Fortran编译器、Python头文件、cmake和一些其他低级工具。

    • TL; DR**:在Windows上编译SciPy非常困难。您可以按照Andrew Nelson的建议安装64位版本的Python并使用pip来获取预构建的wheels。或者您可以使用setup Anaconda/Miniconda for Windows并安装SciPy:
conda install scipy

相关问题