1

にはImportErrorを取得プロジェクトのため、私はGoogleの音声APIを選択するが、私は次のエラーを取得する:Googleの音声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 

私はGoogleのSDKをインストールしてから、私はこのラインでPython用のGoogleクラウドスピーチをインストールアカウント でログイン:

$ pip install --upgrade google-cloud-speech 

そして、私はこのコードを起動しようとしたとき、私はこのエラーを得た:

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 
>>> 
を行う必要がありますGoogleのクラウドクライアント

sudo pip install google-cloud 

をインストールする必要があります