The following program generates the following error:
import os
#import time
import speech_recognition
from subprocess import call
from platform import python_version
home = os.path.expanduser("~")
from gtts import gTTS
from bs4 import BeautifulSoup
import pyaudio
import PyPDF2
print('Speech Recognition version ' + speech_recognition.__version__)
print('Attempting to read Preamble')
wav = "C:\\Users\\Owner\\PycharmProjects\\Government\\Governing_documents\\Preamble.wav"
recognizer = speech_recognition.Recognizer()
preamble = speech_recognition.AudioFile(wav)
with preamble as source:
audio = recognizer.record(source)
type(audio)
recognizer.recognize_google(audio)
ERROR MESSAGES FROM PYCHARM:
C:\Users\Owner\PycharmProjects\Speech\venv\Scripts\python.exe C:\Users\Owner\PycharmProjects\Speech\Wav_to_Text.py
Traceback (most recent call last):
File "C:\Users\Owner\PycharmProjects\Speech\Wav_to_Text.py", line 3, in <module>
import speech_recognition
ModuleNotFoundError: No module named 'speech_recognition'
CMD PROMPT:
C:\Users\Owner\PycharmProjects\Speech>python Wav_to_Text.py
Traceback (most recent call last):
File "C:\Users\Owner\PycharmProjects\Speech\Wav_to_Text.py", line 3, in <module>
import speech_recognition
ModuleNotFoundError: No module named 'speech_recognition'
I tried modifying the environment variables to ensure that the libraries were visible. I checked where the packages were installed and that matched the PATH variable. They still give me an error in PyCharm and cmd