简体   繁体   English

speech_recognition无法导入pyaudio; ModuleNotFoundError

[英]speech_recognition can't import pyaudio; ModuleNotFoundError

I am trying to program a voice assistant using python and the SpeechRecognition library. 我正在尝试使用python和SpeechRecognition库编写语音助手。 But when I execute my program, it runs for about 2 secs and then throws the following Error 但是当我执行我的程序时,它运行大约2秒然后抛出以下错误

[0:02] Decoding of audio.mp3 finished. Traceback (most recent call last): File "/home/USERNAME/PycharmProjects/jarvis/venv/lib/python3.7/site-packages/speech_recognition/__init__.py", line 108, in get_pyaudio import pyaudio ModuleNotFoundError: No module named 'pyaudio'

I have already spent some hours trying different solutions but none seem to work for me. 我已经花了几个小时尝试不同的解决方案,但似乎没有一个适合我。

I am on ubuntu if that helps 如果有帮助的话,我在ubuntu上

尝试确保它是为Python 3安装的,而不是2,如果它在pip上,则运行pip3 install pyaudio

I just figured it out. 我刚想通了。 There was nothing wrong with my installation. 我的安装没有任何问题。 It seems to be a bug in the integrated Terminal of pycharm. 它似乎是pycharm集成终端中的一个错误。 When I moved into my project dir with my linux shell and executed my script everything worked just fine. 当我使用我的linux shell移动到我的项目目录并执行我的脚本时,一切正常。 I don't know, why it didn't work with the built in terminal. 我不知道,为什么它不适用于内置终端。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM