2016-05-08 1 views
0

py2exeを使用してPythonスクリプトからスタンドアロンの実行可能ファイルを作成しようとしています。スクリプトは、Googleのspeech_recognitionモジュールを使用します。私はGoogle検索で見つけたものをたくさん試しましたが、何も問題を解決しようとしていませんでした。(は、setup.pyファイルにsubprocessをインポートしようとしました。Speech_recognition py2exeサブプロセス

アイデア? (P.S:実際にはpy2exeからpyinstallerに変更したくありません。スクリプトに必要な別のモジュールに未解決のバグがあるためです)。私はオーディオ を圧縮するflac.exeを実行しようとしていると思います

Traceback (most recent call last): File "core_v_0.1.py", line 210, in <module> 
    search_for_series() 
    File "core_v_0.1.py", line 111, in search_for_series 
    answer=user_speech_recognition() 
    File "core_v_0.1.py", line 147, in user_speech_recognition 
    user_said_=r.recognize_google(audio) 
    File "speech_recognition\__init__.pyc", line 608, in recognize_g 
    File "speech_recognition\__init__.pyc", line 351, in get_flac_da 
    File "subprocess.pyc", line 710, in __init__ 
    File "subprocess.pyc", line 958, in _execute_child 
WindowsError: [Error 2] The system cannot find the file specified 

答えて

1

とそのexeファイルをpy2exeでバンドルされていません。これは私が実行中の特定のポイントの後に取得していますものです。このようなsetup.pyでsetupへ 使用data_file param含まれる任意のファイルを強制的に:

setup(
    .... 
    data_files = [('path/to/googlespeachhelpers', ['/path/to/googlespeachflac.exe']] 
    .... 
) 

を私はGoogleのspeachでプレイしていないので、モジュールがどこに見つけるかパスは例えば、チェックする必要がありますflac.exe。