1

클라이언트 모듈에 ImportError를 얻을 나는 구글 음성 API를 선택하지만, 나는 다음과 같은 오류 얻을 :구글 음성 API를 시도하지만 프로젝트에 대한 (프랑스어) 음성 인식을해야

[email protected]:~ $ sudo python ~/sttG.py 
Traceback (most recent call last): 
    File "sttG.py", line 1, in <module> 
    from google.cloud import speech 
    File "/usr/local/lib/python2.7/dist-packages/google/cloud/speech/__init__.py", line 22, in <module> 
    from google.cloud.speech.client import Client 
    File "/usr/local/lib/python2.7/dist-packages/google/cloud/speech/client.py", line 19, in <module> 
    from google.cloud.client import Client as BaseClient 
ImportError: No module named client 

처음

,369 :이 코드를 실행하려고 할 때

$ pip install --upgrade google-cloud-speech 

그리고 나는이 오류가 발생했습니다 : 나는 구글 SDK를 설치하고 내 계정으로 로그인 나는이 줄 파이썬에 대한 구글의 클라우드 연설을 설치

from google.cloud import speech 
client = speech.Client() 
sample = client.sample(source_uri='gs://my-bucket/recording.flac', 
         encoding=speech.Encoding.FLAC, 
         sample_rate=44100) 
results = sample.sync_recognize(
    language_code='en-GB', max_alternatives=2) 
for result in results: 
    for alternative in result.alternatives: 
     print('=' * 20) 
     print('transcript: ' + alternative.transcript) 
     print('confidence: ' + str(alternative.confidence)) 

나는이 2 페이지를 따르
google-cloud-speech 0.25.1
google-cloud client

답변

1

당신은 그것을

:~ $ python 
Python 2.7.9 (default, Sep 17 2016, 20:26:04) 
[GCC 4.9.2] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> from google.cloud import speech 
>>> 
을해야 구글 클라우드 클라이언트

sudo pip install google-cloud 

를 설치해야