我的系统:Windows 10 64位,Python 3.5.4,pip 9.0.1
我的代码:
#. Tkinter codes
#.........................
#.........................
def main():
r = sr.Recognizer()
with sr.Microphone() as source:
status.set("Listening...") #Tkinter Label
sound = r.listen(ses_kaynagi)
try:
status.set("Processing...") #Tkinter Label
word=r.recognize_google(sound, language="tr-tr")
print(word)
except:
pass
while True:
keyboard.add_hotkey('ctrl+alt', main) #Keyboard Library
我用PyInstaller(pyinstaller.exe --onefile)冻结了代码,一切正常。但是当我隐藏控制台(pyinstaller.exe --onefile --noconsole或--windowed)时,我的代码输入了except块。因此word=r.recognize_google(sound, language="tr-tr")
无法正常工作。