语音识别py2exe子流程

2024-04-20 16:20:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用py2exe从python脚本创建一个独立的可执行文件。该脚本使用Google的speech_recognition模块。我尝试了很多在google搜索中找到的东西,但似乎没有什么能解决这个问题(尝试导入setup.py文件中的subprocess,包括我的脚本可能使用的每个模块,等等)。你知道吗

有什么想法吗?(注意:我不想从py2exe改成pyinstaller,因为它在我的脚本中需要的另一个模块中有一个未解决的bug)。这就是我在执行过程中的某个时刻之后得到的结果:

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

Tags: 模块inpycore脚本initgoogleline
1条回答
网友
1楼 · 发布于 2024-04-20 16:20:45

我猜它是想运行flac.exe来压缩音频 而且该exe不是由py2exe绑定的。强制包含任意文件 在中使用^{} paramsetup设置.py像这样:

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

我还没有玩过googlespeach,所以必须检查路径,例如模块希望找到的地方flac.exe文件. 你知道吗

相关问题 更多 >