python - 使用 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 上
解决方案
我终于能够通过以下方式解决问题:
- 正如 Diego Contreras 在评论中指出的那样,安装和安装龙卷风并导入龙卷风
- 按照帖子中提到的步骤[您如何解决“找不到隐藏的导入!” pyinstaller 中针对 scipy 的警告?
确保您的 Microsoft 构建工具已安装并且 DLL 位置存在于 PATH(x86 和 x64)中。编辑 PATH 变量后重新启动机器。
推荐阅读
- ruby-on-rails - Rails 5.2 AngularJS 和 html 模板
- go - 如何在 Golang 中为 cmd 工具编写基准测试?
- python - Ctrl C 不会杀死 Python 中的循环子进程
- php - 如何通过 PHP 代码将文本和图像内容插入谷歌文档
- c - 让用户在 C 中指定一个文件名
- python - 无法在 Tensorflow 的 Keras 中添加两层
- javascript - EventListeners 不适用于 A-Frame 父实体
- docker - 将 JIRA 从本机实例恢复到 docker 容器
- kdb - 如何在kdb中计算年初至今的小计
- javascript - 使用锚标签下载文件时如何获取下载时间?