折腾半天,python 311 安装greenlet失败
问题
在安装playwright时,总是提示greenlet安装失败。无论是单独安装还是一起安装,均失败
(auto_iq) D:\auto_iq>pip install greenlet==2.0.2
Collecting greenlet==2.0.2
Using cached greenlet-2.0.2.tar.gz (164 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: greenlet
DEPRECATION: Building 'greenlet' using the legacy setup.py bdist_wheel mechanism, which will be removed in a future version. pip 25.3 will enforce thi
s behaviour change. A possible replacement is to use the standardized build interface by setting the `--use-pep517` option, (possibly combined with `--n
o-build-isolation`), or adding a `pyproject.toml` file to the source tree of 'greenlet'. Discussion can be found at https://github.com/pypa/pip/issues/6334
Building wheel for greenlet (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [91 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win32-cpython-311
creating build\lib.win32-cpython-311\greenlet
copying src\greenlet\__init__.py -> build\lib.win32-cpython-311\greenlet
creating build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\__init__.py -> build\lib.win32-cpython-311\greenlet\platform
creating build\lib.win32-cpython-311\greenlet\tests
copying src\greenlet\tests\leakcheck.py -> build\lib.win32-cpython-311\greenlet\tests
copying src\greenlet\tests\test_contextvars.py -> build\lib.win32-cpython-311\greenlet\tests
copying src\greenlet\tests\test_cpp.py -> build\lib.win32-cpython-311\greenlet\tests
copying src\greenlet\tests\test_extension_interface.py -> build\lib.win32-cpython-311\greenlet\tests
copying src\greenlet\tests\test_gc.py -> build\lib.win32-cpython-311\greenlet\tests
copying src\greenlet\tests\test_generator.py -> build\lib.win32-cpython-311\greenlet\tests
copying src\greenlet\tests\test_generator_nested.py -> build\lib.win32-cpython-311\greenlet\tests
copying src\greenlet\tests\test_greenlet.py -> build\lib.win32-cpython-311\greenlet\tests
copying src\greenlet\tests\test_greenlet_trash.py -> build\lib.win32-cpython-311\greenlet\tests
copying src\greenlet\tests\test_leaks.py -> build\lib.win32-cpython-311\greenlet\tests
copying src\greenlet\tests\test_stack_saved.py -> build\lib.win32-cpython-311\greenlet\tests
copying src\greenlet\tests\test_throw.py -> build\lib.win32-cpython-311\greenlet\tests
copying src\greenlet\tests\test_tracing.py -> build\lib.win32-cpython-311\greenlet\tests
copying src\greenlet\tests\test_version.py -> build\lib.win32-cpython-311\greenlet\tests
copying src\greenlet\tests\test_weakref.py -> build\lib.win32-cpython-311\greenlet\tests
copying src\greenlet\tests\__init__.py -> build\lib.win32-cpython-311\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
ERROR setuptools_scm._file_finders.git listing git files failed - pretending there aren't any
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\greenlet.cpp -> build\lib.win32-cpython-311\greenlet
copying src\greenlet\greenlet.h -> build\lib.win32-cpython-311\greenlet
copying src\greenlet\greenlet_allocator.hpp -> build\lib.win32-cpython-311\greenlet
copying src\greenlet\greenlet_compiler_compat.hpp -> build\lib.win32-cpython-311\greenlet
copying src\greenlet\greenlet_cpython_compat.hpp -> build\lib.win32-cpython-311\greenlet
copying src\greenlet\greenlet_exceptions.hpp -> build\lib.win32-cpython-311\greenlet
copying src\greenlet\greenlet_greenlet.hpp -> build\lib.win32-cpython-311\greenlet
copying src\greenlet\greenlet_internal.hpp -> build\lib.win32-cpython-311\greenlet
copying src\greenlet\greenlet_refs.hpp -> build\lib.win32-cpython-311\greenlet
copying src\greenlet\greenlet_slp_switch.hpp -> build\lib.win32-cpython-311\greenlet
copying src\greenlet\greenlet_thread_state.hpp -> build\lib.win32-cpython-311\greenlet
copying src\greenlet\greenlet_thread_state_dict_cleanup.hpp -> build\lib.win32-cpython-311\greenlet
copying src\greenlet\greenlet_thread_support.hpp -> build\lib.win32-cpython-311\greenlet
copying src\greenlet\slp_platformselect.h -> build\lib.win32-cpython-311\greenlet
copying src\greenlet\platform\setup_switch_x64_masm.cmd -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_aarch64_gcc.h -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_alpha_unix.h -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_amd64_unix.h -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_arm32_gcc.h -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_arm32_ios.h -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_arm64_masm.asm -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_arm64_masm.obj -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_arm64_msvc.h -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_csky_gcc.h -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_m68k_gcc.h -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_mips_unix.h -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_ppc64_aix.h -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_ppc64_linux.h -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_ppc_aix.h -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_ppc_linux.h -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_ppc_macosx.h -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_ppc_unix.h -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_riscv_unix.h -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_s390_unix.h -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_sparc_sun_gcc.h -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_x32_unix.h -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_x64_masm.asm -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_x64_masm.obj -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_x64_msvc.h -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_x86_msvc.h -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\platform\switch_x86_unix.h -> build\lib.win32-cpython-311\greenlet\platform
copying src\greenlet\tests\_test_extension.c -> build\lib.win32-cpython-311\greenlet\tests
copying src\greenlet\tests\_test_extension_cpp.cpp -> build\lib.win32-cpython-311\greenlet\tests
running build_ext
building 'greenlet._greenlet' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for greenlet
Running setup.py clean for greenlet
Failed to build greenlet
ERROR: Failed to build installable wheels for some pyproject.toml based projects (greenlet)
解决步骤
1. 根据这里https://github.com/python-greenlet/greenlet/issues/346,尝试安装更底版本的greenlet==1.1.3,还是失败
2. 还是上面链接有人建议的,安装msvc-runtime, 还是失败
3. 再次没办法,根据提示,安装C++的东西VC_redist.x64.exe. 还是失败
4. 回到国内搜索,有一个文章https://blog.csdn.net/weixin_42714051/article/details/126571386 ,但根据提示还是失败
5. 准备放弃时,试着去找对应的greenlet版本 https://mirrors.cloud.tencent.com/pypi/simple/greenlet/, 发现没有python 11 32 bit的wheel的包
6. 回来确认python版本,真相大白,原来python装的是32位, greenlet在python311不支32位的了

Email:362299908@qq.com
浙公网安备 33010602011771号