You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MacBook下pyttsx3出现SIGSEGV错误(退出码139)求助

解决Mac上pyttsx3初始化时的SIGSEGV错误
  • 切换Python环境到系统自带或Homebrew安装的版本
    部分PyCharm自带的Python解释器和pyttsx3的Mac驱动存在兼容性问题,导致段错误。可以通过Homebrew安装稳定版Python:
    brew install python
    之后在PyCharm中配置该解释器:进入File > Settings > Project: [项目名] > Python Interpreter,添加Homebrew安装的Python路径(通常为/usr/local/bin/python3或/opt/homebrew/bin/python3)。

  • 改用系统say命令替代pyttsx3
    Mac自带的say命令稳定性更高,可直接通过subprocess调用:

    import subprocess
    # 基础语音输出
    subprocess.run(["say", "Hello"])
    # 指定女声(可用`say -v '?'`查看所有可用语音)
    subprocess.run(["say", "-v", "Karen", "Hello"])
    
  • 明确指定pyttsx3的Mac驱动
    若坚持使用pyttsx3,初始化时明确指定nsss驱动,避免自动检测出错:

    import pyttsx3 as tts
    
    engine = tts.init(driverName='nsss')
    voices = engine.getProperty('voices')
    engine.setProperty("voice", voices[1].id)
    engine.say("Hello")
    engine.runAndWait()
    

内容的提问来源于stack exchange,提问作者nerdintown

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.23 09:02:14