安装python-espeak报错,需Microsoft Visual C++ 14.0及以上版本求解决
解决python-espeak安装时的VC++编译错误
问题重现
执行命令 pip install python-espeak 时出现构建wheel失败,核心报错:
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools"
完整命令行输出:
C:\Users\akhil>pip install python-espeak Collecting python-espeak Downloading python-espeak-0.6.3.tar.gz (9.1 kB) Preparing metadata (setup.py) ... done Building wheels for collected packages: python-espeak Building wheel for python-espeak (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [10 lines of output] running bdist_wheel running build running build_py creating build creating build\lib.win-amd64-3.9 creating build\lib.win-amd64-3.9\espeak copying espeak\__init__.py -> build\lib.win-amd64-3.9\espeak running build_ext building 'espeak.core' 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 python-espeak Running setup.py clean for python-espeak Failed to build python-espeak Installing collected packages: python-espeak Running setup.py install for python-espeak ... error error: subprocess-exited-with-error × Running setup.py install for python-espeak did not run successfully. │ exit code: 1 ╰─> [10 lines of output] running install running build running build_py creating build creating build\lib.win-amd64-3.9 creating build\lib.win-amd64-3.9\espeak copying espeak\__init__.py -> build\lib.win-amd64-3.9\espeak running build_ext building 'espeak.core' 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: legacy-install-failure × Encountered error while trying to install package. ╰─> python-espeak note: This is an issue with the package mentioned above, not pip. hint: See above for output from the failure.
解决方法
方法1:安装VC++构建工具
- 下载Microsoft C++ Build Tools安装程序,运行后勾选**Desktop development with C++**组件(包含VC++14.0及以上的编译工具链)
- 完成安装后重启命令行终端,再次执行
pip install python-espeak
方法2:使用预编译wheel包(跳过编译)
- 找到对应你Python版本(比如3.9)和系统架构(win-amd64)的python-espeak预编译wheel文件
- 下载后执行
pip install 你的wheel文件名.whl完成安装,这种方式不需要本地编译,也就不用依赖VC++工具
内容的提问来源于stack exchange,提问作者Dr Strange
相关产品推荐
相关产品推荐

