0

我尝试使用 vosk 库从 python 文件编译 exe 文件。编译没问题。每次我尝试运行 exe 时都会出现此错误:

Traceback (most recent call last):
  File "Vega.py", line 10, in <module>
    from vosk import Model, KaldiRecognizer
  File "C:\Users\Alexandr\AppData\Local\Temp\embedded.zm51h3af.zip\shibokensupport\__feature__.py", line 142, in _import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 540, in exec_module
  File "vosk\__init__.py", line 21, in <module>
  File "vosk\__init__.py", line 12, in open_dll
  File "os.py", line 1111, in add_dll_directory
FileNotFoundError: [WinError 2] The specified file cannot be found: 'C:\\Users\\Alexandr\\AppData\\Local\\Temp\\_MEI126762\\vosk'
[920] Failed to execute script Vega

我应该怎么办?

4

1 回答 1

0

解决了

您需要创建 .spec 文件并在此处编写类似的内容datas=[('D:\\Python39\\Lib\\site-packages\\vosk', './vosk')]

于 2021-06-28T20:40:46.200 回答