收到错误:尝试通过 pip 安装 sqlalchemy 时,--plat-name 必须是 ('win32', 'win-amd64', 'win-arm32', 'win-arm64') 之一

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

我正在做一个需要 Flask 的项目,为此我必须安装 sqlalchemy。我正在尝试在 Windows 11 上安装它。问题是,每次我尝试下载 sqlAlchemy 时都会收到以下错误:

C:\dev\SEF_Assignment2
(env) λ pip install SQLAlchemy
Collecting SQLAlchemy
  Using cached SQLAlchemy-2.0.25-py3-none-any.whl.metadata (9.6 kB)
Collecting typing-extensions>=4.6.0 (from SQLAlchemy)
  Using cached typing_extensions-4.9.0-py3-none-any.whl.metadata (3.0 kB)
Collecting greenlet!=0.4.17 (from SQLAlchemy)
  Using cached greenlet-3.0.3.tar.gz (182 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Using cached SQLAlchemy-2.0.25-py3-none-any.whl (1.9 MB)
Using cached typing_extensions-4.9.0-py3-none-any.whl (32 kB)
Building wheels for collected packages: greenlet
  Building wheel for greenlet (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for greenlet (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [108 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.mingw_x86_64-cpython-310
      creating build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\__init__.py -> build\lib.mingw_x86_64-cpython-310\greenlet
      creating build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\__init__.py -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      creating build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\fail_clearing_run_switches.py -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\fail_cpp_exception.py -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\fail_initialstub_already_started.py -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\fail_slp_switch.py -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\fail_switch_three_greenlets.py -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\fail_switch_three_greenlets2.py -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\fail_switch_two_greenlets.py -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\leakcheck.py -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\test_contextvars.py -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\test_cpp.py -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\test_extension_interface.py -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\test_gc.py -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\test_generator.py -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\test_generator_nested.py -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\test_greenlet.py -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\test_greenlet_trash.py -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\test_leaks.py -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\test_stack_saved.py -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\test_throw.py -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\test_tracing.py -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\test_version.py -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\test_weakref.py -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\__init__.py -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      running egg_info
      writing src\greenlet.egg-info\PKG-INFO
      writing dependency_links to src\greenlet.egg-info\dependency_links.txt
      writing requirements to src\greenlet.egg-info\requires.txt
      writing top-level names to src\greenlet.egg-info\top_level.txt
      reading manifest file 'src\greenlet.egg-info\SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no previously-included files found matching 'benchmarks\*.json'
      no previously-included directories found matching 'docs\_build'
      warning: no files found matching '*.py' under directory 'appveyor'
      warning: no previously-included files matching '*.pyc' found anywhere in distribution
      warning: no previously-included files matching '*.pyd' found anywhere in distribution
      warning: no previously-included files matching '*.so' found anywhere in distribution
      warning: no previously-included files matching '.coverage' found anywhere in distribution
      adding license file 'LICENSE'
      adding license file 'LICENSE.PSF'
      adding license file 'AUTHORS'
      writing manifest file 'src\greenlet.egg-info\SOURCES.txt'
      copying src\greenlet\TBrokenGreenlet.cpp -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\TExceptionState.cpp -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\TGreenlet.cpp -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\TGreenletGlobals.cpp -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\TMainGreenlet.cpp -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\TPythonState.cpp -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\TStackState.cpp -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\TThreadStateDestroy.cpp -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\TUserGreenlet.cpp -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\greenlet.cpp -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\greenlet.h -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\greenlet_allocator.hpp -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\greenlet_compiler_compat.hpp -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\greenlet_cpython_add_pending.hpp -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\greenlet_cpython_compat.hpp -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\greenlet_exceptions.hpp -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\greenlet_greenlet.hpp -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\greenlet_internal.hpp -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\greenlet_refs.hpp -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\greenlet_slp_switch.hpp -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\greenlet_thread_state.hpp -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\greenlet_thread_state_dict_cleanup.hpp -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\greenlet_thread_support.hpp -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\slp_platformselect.h -> build\lib.mingw_x86_64-cpython-310\greenlet
      copying src\greenlet\platform\setup_switch_x64_masm.cmd -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_aarch64_gcc.h -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_alpha_unix.h -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_amd64_unix.h -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_arm32_gcc.h -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_arm32_ios.h -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_arm64_masm.asm -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_arm64_masm.obj -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_arm64_msvc.h -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_csky_gcc.h -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_loongarch64_linux.h -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_m68k_gcc.h -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_mips_unix.h -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_ppc64_aix.h -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_ppc64_linux.h -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_ppc_aix.h -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_ppc_linux.h -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_ppc_macosx.h -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_ppc_unix.h -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_riscv_unix.h -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_s390_unix.h -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_sparc_sun_gcc.h -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_x32_unix.h -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_x64_masm.asm -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_x64_masm.obj -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_x64_msvc.h -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_x86_msvc.h -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\platform\switch_x86_unix.h -> build\lib.mingw_x86_64-cpython-310\greenlet\platform
      copying src\greenlet\tests\_test_extension.c -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      copying src\greenlet\tests\_test_extension_cpp.cpp -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
      running build_ext
      building 'greenlet._greenlet' extension
      error: --plat-name must be one of ('win32', 'win-amd64', 'win-arm32', 'win-arm64')
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for greenlet
Failed to build greenlet
ERROR: Could not build wheels for greenlet, which is required to install pyproject.toml-based projects

我尝试删除并重新安装 python,以防与它有关,但无济于事。我尝试在网上寻找解决方案,但这也陷入了死胡同。

python pip mingw-w64 msys2 greenlets
1个回答
0
投票

MSYS2 用户在这里,我定期构建 C++ 包。请确保设置以下环境变量(这是一个解决方法)。

export SETUPTOOLS_USE_DISTUTILS=stdlib

随后,您可以“python setup.py”或“pip install”

© www.soinside.com 2019 - 2024. All rights reserved.