我正在尝试使用我导入的其他模块运行代码。它甚至由于与“ AppKit”缺失模块有关的错误而无法运行(据我所知)。但是,我无法使用pip安装“ AppKit”,它也不起作用。如何修复它以启动代码运行?
import os
import time
import playsound
import speech_recognition as sr
from gtts import gTTS
def speak(text):
tts = gTTS(text=text, lang='en')
filename = 'voice.mp3'
tts.save(filename)
playsound.playsound(filename)
speak('please say it')
回溯(最近通话最近):文件 “ / Users / a123 / Library / Application Support / Sublime Text 3 / Packages / User / test.py“,第14行,在 说(请说)(“请说出来”)文件“ / Users / a123 / Library / Application Support / Sublime Text 3 / Packages / User / test.py” playound.playsound(filename)文件“ /anaconda3/lib/python3.7/site-packages/playsound.py”,第55行,在 _playsoundOSX 从AppKit导入NSSound ModuleNotFoundError:没有名为“ AppKit”的模块[在2.2s中完成,退出代码为1] [shell_cmd:python -u“ / Users / a123 / Library / Application Support / Sublime Text 3 / Packages / User / test.py”] [dir:/ Users / a123 / Library / Application 支持/崇高文字3 /包/用户] [路径: / usr / bin:/ bin:/ usr / sbin:/ sbin]