安装FastAPI脚手架的依赖项报错:
(vue-fastapi-admin-main) PS D:\vue-fastapi-admin-main> uv pip install -r .\pyproject.toml
Resolved 64 packages in 2.89s
× Failed to build `uvloop==0.21.0`
├─▶ The build backend returned an error
╰─▶ Call to `setuptools.build_meta.build_wheel` failed (exit code: 1)[stderr]
Traceback (most recent call last):
File "<string>", line 14, in <module>
File
"C:\Users\xukai\AppData\Local\uv\cache\builds-v0\.tmpDVK4DI\Lib\site-packages\setuptools\build_meta.py",
line 334, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"C:\Users\xukai\AppData\Local\uv\cache\builds-v0\.tmpDVK4DI\Lib\site-packages\setuptools\build_meta.py",
line 304, in _get_build_requires
self.run_setup()
File
"C:\Users\xukai\AppData\Local\uv\cache\builds-v0\.tmpDVK4DI\Lib\site-packages\setuptools\build_meta.py",
hint: This usually indicates a problem with the package or the build environment.
分析原因:
安装依赖中出现了uvloop==0.21.0,uvloop 是一个基于 libuv 和 Cython 的高性能异步事件循环库,旨在替代 Python 标准库 asyncio
的默认事件循环,显著提升异步 I/O 密集型应用的性能。其核心优势包括接近 Go 和 Node.js 的网络吞吐能力,以及完全兼容 asyncio
API 的设计。
官方明确声明不支持Windows
根据多个搜索结果,uvloop 的文档明确提到其仅支持 linux 平台和 Python 3.5 及以上版本。例如,在安装或运行时,若尝试在 Windows 上构建 uvloop,会触发错误提示(如 RuntimeError: uvloop does not support Windows at the moment
),表明开发者未将 Windows 纳入支持范围。
需要改写:
在windows系统下,自动跳过不安装,就不会出现兼容性问题。