安装Coqui AI TTS时出现cl.exe错误,恳请提供修复方案
错误信息
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit code 2
[end of output]note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for tts
Failed to build tts
ERROR: Could not build wheels for tts, which is required to install pyproject.toml-based projects
修复建议
确保VC编译环境正确加载
打开Visual Studio 2015 x64 Native Tools Command Prompt(对应C++ Build Tools 14版本),在这个命令行窗口里执行pip安装命令。直接在普通CMD或PowerShell里可能没加载完整的VC环境变量。更新编译依赖工具
执行以下命令升级pip、setuptools、wheel和cython,这些工具版本过旧可能导致编译失败:pip install --upgrade pip setuptools wheel cython验证Python版本兼容性
Coqui TTS仅支持Python 3.8~3.11版本,执行python --version确认版本,若不在范围内,切换到兼容版本后重新安装。尝试安装预编译wheel
跳过本地编译,强制使用预编译包:pip install tts --only-binary :all:若此命令失败,说明当前平台/版本没有预编译wheel,继续尝试其他方案。
清理pip缓存
缓存的损坏文件可能干扰安装,执行以下命令清理后重新安装:pip cache purge pip install tts检查Windows SDK完整性
打开Visual Studio Installer,确认C++ Build Tools 14组件中已安装Windows 10 SDK(或对应系统版本的SDK),缺少SDK会导致编译时找不到头文件或库文件。设置编译参数
部分依赖编译需要特定参数,尝试设置环境变量后安装:set CMAKE_ARGS="-DONNXruntime_BUILD_SHARED_LIBS=OFF" pip install tts
内容的提问来源于stack exchange,提问作者Christina Parissi

