pocketsphinx no module named pocketsphinx found

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue Jul 12 05:07:05 EDT 2016


On Tuesday 12 July 2016 18:47, ldompeling at casema.nl wrote:

> Op dinsdag 12 juli 2016 10:00:51 UTC+2 schreef ldomp... at casema.nl:
>> I try to run an example python file for pocketsphinx but I get this error:
>> 
>> File "continuous_test.py", line 5, in <module>
>>     from pocketsphinx.pocketsphinx import *
>> ImportError: No module named pocketsphinx
>> 
>> Does somebody knows how to repair this.
> 
> I think that pocketsphinx installed successfully because I install it on my
> raspberry pi with sudo-apt-get 

Are you running two different versions of Python? If you are, then perhaps apt-
get installed it for the system Python, but you're running a different version.

If your Raspberry Pi is running "locate", you can run this:

locate site-packages


and it will show you all the third-party Python packages installed in the 
standard location. Can you see pocketsphinx? If not, then it is not installed.

Once you are sure it is installed, try running these lines at the Python 
prompt, one at a time, and tell us exactly what happens:


import pocketsphinx


If there is no error, what does this give?0

print (pocketsphinx.__file__)


(There are TWO underscores at the start and end of "file".)



> How can I create a module named
> pocketsphinx.py to try out the library.

DON'T do that. You **do not** want to create a module called "pocketsphinx.py". 
If you have, that may be your problem. Call it something else, like "main.py" 
or "testps.py", or "mypocketsphinx.py".




-- 
Steve




More information about the Python-list mailing list