首页 > 解决方案 > 使用 Pyinstaller 运行 exe 构建时出错

问题描述

以下是我正在使用的模块列表:

import sys
import cv2
import numpy as np
import pytesseract
from PIL import Image
from sklearn.cluster import MeanShift, estimate_bandwidth
from sklearn.datasets.samples_generator import make_blobs
import re
import jellyfish

例外

Traceback (most recent call last):
  File "c:\python\lib\site-packages\matplotlib\backends\backend_webagg.py", line 29, in <module>
    import tornado
ModuleNotFoundError: No module named 'tornado'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 12, in <module>
  File "c:\python\lib\site-packages\matplotlib\backends\backend_webagg.py", line 31, in <module>
    raise RuntimeError("The WebAgg backend requires Tornado.")

运行生成的exe时出错:

File "c:\python\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\scipy\sparse\linalg\isolve\iterative.py", line 7, in <module>
  File "c:\python\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 714, in load_module
    module = loader.load_module(fullname)
ImportError: DLL load failed: The specified module could not be found.
[22724] Failed to execute script main

我已经在 git 链接上尝试了建议的解决方案,但似乎没有任何效果。脚本本身运行良好。我在 Windows 10、Python 3.6 上

标签: pythonpython-3.xpyinstallerpy2exe

解决方案


我终于能够通过以下方式解决问题:

  1. 正如 Diego Contreras 在评论中指出的那样,安装和安装龙卷风并​​导入龙卷风
  2. 按照帖子中提到的步骤[您如何解决“找不到隐藏的导入!” pyinstaller 中针对 scipy 的警告?

确保您的 Microsoft 构建工具已安装并且 DLL 位置存在于 PATH(x86 和 x64)中。编辑 PATH 变量后重新启动机器。


推荐阅读