2013-01-08 10 views
0

pocketsphinx_continuous으로 음성을 인식 할 수 있으므로 pocketsphinx-0.8Ubuntu 12.04에 성공적으로 설치했습니다.파이썬에서 모듈 가져 오기

어떻게 python에서 import pocketsphinx에 지금과 같은 pocketsphinx-0.8을 설정 한 후 나는 그것이 PocketSphinx 또는 무언가 같이, 대소 문자를 구분 일거야 ImportError: No module named pocketsphinx

+1

학습을 PYTHONPATH 및 python 모듈에 대한 정보 http://docs.python.org/2/tutorial/modules.html#the-module-search-path –

답변

1

을 얻고있다.

내가 파이썬 대화식 쉘의 help() FUNC를 사용하여 검색 할 것

..

[email protected]:~/openstack/nova$ python 
Python 2.7.3 (default, Sep 26 2012, 21:51:14) 
[GCC 4.7.2] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> help() 

Welcome to Python 2.7! This is the online help utility. 

If this is your first time using Python, you should definitely check out 
the tutorial on the Internet at http://docs.python.org/2.7/tutorial/. 

Enter the name of any module, keyword, or topic to get help on writing 
Python programs and using Python modules. To quit this help utility and 
return to the interpreter, just type "quit". 

To get a list of available modules, keywords, or topics, type "modules", 
"keywords", or "topics". Each module also comes with a one-line summary 
of what it does; to list the modules whose summaries contain a given word 
such as "spam", type "modules spam". 

help> modules phinx 

Here is a list of matching modules. Enter any module name to get more help. 

matplotlib.sphinxext 
matplotlib.sphinxext.ipython_console_highlighting - reST directive for syntax-highlighting ipython interactive sessions. 
matplotlib.sphinxext.mathmpl 
matplotlib.sphinxext.only_directives 
matplotlib.sphinxext.plot_directive - A directive for including a matplotlib plot in a Sphinx document. 

그래서 나를 위해 단순한 수입의 :

[email protected]:~/Downloads/pocketsphinx-0.8$ sudo apt-get install python-pocketsphinx 
... 
>>> import pocketsphinx 
>>> dir(pocketsphinx) 
['Decoder', 'LatLink', 'LatLinkIterator', 'LatNode', 'LatNodeIterator', 'Lattice', '__builtins__', '__doc__', '__file__', '__name__', '__package__'] 

에서 설치하기 어려웠다 소스 (포기),하지만 쉽게 우분투 lib를 설치합니다. http://www.cs.columbia.edu/~ecooper/CS4706/ps-mac.html

0

올바르게 설치 한 경우 pocketsphinx,이 명령이 작동해야합니다 : 그것은 소스를 설치하는 데 유용 할 수 있었던 것처럼


이 사이트는 보인다. 여전히 문제가있는 경우

import pocketsphinx 

, 다음 블록을 제외/시도에 넣어 :

try: 
    import pocketsphinx 
except: 
    pass 

import pocketsphinx 

우분투에서 pocketsphinx를 설치하려면,이 명령을 사용할 수 있습니다

sudo apt-get install python-pocketsphinx