【问题标题】:Error on running exe build using Pyinstaller使用 Pyinstaller 运行 exe 构建时出错
【发布时间】:2018-10-07 15:58:55
【问题描述】:

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

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 上

【问题讨论】:

  • 你试过 cx_Freeze 吗?
  • 是的,我试过了,但我认为我无法正确配置 setup.py,它给了我很多错误
  • 尝试 python -m pip install tornado 并导入 tornado。
  • 新警告:65756 警告:未找到隐藏导入“sklearn.utils.sparsetools._graph_validation”! 65757 警告:未找到隐藏导入“sklearn.utils.sparsetools._graph_tools”!运行生成的 exe 时出现的新错误可能与警告有关: Traceback (最近一次调用最后一次): File "main.py", line 7, in from sklearn.cluster import MeanShift, estimate_bandwidth File "c:\python\ lib\site-packages\PyInstaller\loader\pyimod03_importers.py",第 631 行,在 exec_module exec(bytecode, module.__dict__)
  • 我终于可以运行exe了。非常感谢您的 cmets。虽然他们没有直接回答我的问题,但肯定帮助我找到了正确的方向。

标签: python python-3.x pyinstaller py2exe


【解决方案1】:

我最终通过以下方式解决了这个问题:

  1. 安装和安装龙卷风并​​导入龙卷风所指出的 迭戈孔特雷拉斯在 cmets
  2. 按照帖子中提到的步骤 [How do you resolve 'hidden imports not found!' warnings in pyinstaller for scipy?

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-04-22
    • 1970-01-01
    • 2019-11-17
    • 2020-02-27
    • 2020-07-27
    • 2019-03-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多