0

How to solve that problem i am facing in code import but i import but it not working.how to solve that problem

import speech_recognition as sr
import smtplib
import pyaudio
import platform
import sys
from bs4 import BeautifulSoup
import email

i face that problem

Traceback (most recent call last):
File "<ipython-input-5-77331e0ff612>", line 1, in <module>
runfile('C:/Users/atiqpc/.spyder-py3/temp.py', 
wdir='C:/Users/atiqpc/.spyder-py3')
File "E:\anacoda\lib\site- 
packages\spyder\utils\site\sitecustomize.py"line705, in runfile
execfile(filename, namespace)
File "E:\anacoda\lib\site-packages\spyder\utils\site\sitecustomize.py", line 
102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/atiqpc/.spyder-py3/temp.py", line 9, in <module>
import speech_recognition as sr
ModuleNotFoundError: No module named 'speech_recognition'
4
  • It looks like that your python module speech_recognition is not installed. Check PYTHONPATH. Commented Apr 14, 2019 at 18:35
  • can you list out your folder structure? and how (and in which directory that) you run temp.py? Commented Apr 14, 2019 at 18:38
  • yes it is problem runfile('C:/Users/atiqpc/.spyder-py3/temp.py', wdir='C:/Users/atiqpc/.spyder-py3') Commented Apr 14, 2019 at 18:40
  • what files are in .spyder-py3? are you using virtualenv? have you installed libraries with pip install -r requirements.txt? if so, what's in requirements.txt python version? Commented Apr 14, 2019 at 18:54

1 Answer 1

1

When you Read The Fine Manual you'll see that it is important to

$ pip install SpeechRecognition

along with dependencies.

Use this to help debug the situation:

import pprint
import sys

pprint.pprint(sys.path)

Look for a directory corresponding to the place pip installed the package. If you do

$ export PYTHONPATH=/some/dir/containing/package

then import should be able to find it.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.