Came across the error while experimenting with pocketsphinx – CMU Speech Recognition Kit.
Modules already installed by package manager:
Python shell is able to locate libs
help(‘pocketsphinx’) & dir(‘pocketsphinx’) works fine on the python shell, but importing it in the external script blows up with the below error:
Traceback (most recent call last): File "pythonPocketSphinxTest2.py", line 6, in < module > import pocketsphinx ImportError: No module named pocketsphinx
The system is not able to find the python libs, just provide PYTHONPATH to system path.
Add below lines:
export PYTHONPATH=/usr/lib/pymodules/python2.7 export PATH=$PATH:$PYTHONPATH
Save and exit.
Thats It. We are done here. Cheers.
Note: Add the PYTHONPATH accordingly as where your python is present.
Yash Sharma is a Big Data & Machine Learning Engineer, A newbie OpenSource contributor, Plays guitar and enjoys teaching as part time hobby.
Talk to Yash about Distributed Systems and Data platform designs.