ATIQ UR REHMAN
ATIQ UR REHMAN

Reputation: 448

how to solve import error in my python code?

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'

Upvotes: 0

Views: 1183

Answers (1)

J_H
J_H

Reputation: 20568

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.

Upvotes: 1

Related Questions