找不到cx-freeze模块,有教程的人吗?

问题描述 投票:0回答:1

如何修改我的[[setup.py,以便cx-freeze查找缺少的模块?这是我的setup.py:

# Usage: Each project must have its own folder. # python setup.py build -> build on project directory # python setup.py bdist_msi -> bdist_msi to distribute # python setup.py install -> on "C:\Program Files" > "access denied" by Windows # Using: # Python 3.7 # cffi 1.13.2 # cryptography 2.8 # cx-Freeze 6.0 # cycler 0.10.0 # kiwisolver 1.1.0 # matplotlib 3.1.2 # numpy 1.17.4 # pip 19.3.1 # pycparser 2.19 # pyparsing 2.4.5 # PyQt5 5.13.2 # PyQt5-sip 12.7.0 # python-dateutil 2.8.1 # scipy 1.3.3 # setuptools 41.2.0 # six 1.13.0 from cx_Freeze import setup, Executable buildOptions = dict(packages = [], excludes = [], include_files = [], includes = []) import sys base = 'Win32GUI' if sys.platform=='win32' else None executables = [ Executable('FatigueCalculator.py', base=base) ] setup(name='', # do not use \, :, etc. version = '0.1', description = 'App. for college course Intermediate Mechanics', author="Echeban", author_email="", url="http//mecanica.cadec-online.com",# you can download the .msi options = dict(build_exe = buildOptions), executables = executables)
[正如我读过的许多文章(但我很难理解),我可以生成一个.msi intaller,将其用于在另一台计算机上安装该应用程序,如果安装了Python和PyQt5,但仍未安装该应用程序另一台未安装这些机器的机器。我得到的错误是

找不到第3行模块。这是我的应用程序的import

部分,因此您可以看到第3行是什么:import sys import numpy as np from PyQt5.QtGui import QDoubleValidator from FatigueDialog import Ui_Dialog # in QtDesigner, using "Dialog" from PyQt5.QtWidgets import QDialog, QApplication, QListWidgetItem, QDialogButtonBox, QMessageBox from FatigueKernel import * from FatigueInteractionCriteria import * from PyQt5 import QtCore, QtGui from PyQt5.QtGui import QIcon, QPixmap
问题似乎是

PyQt5.QtGui

。接下来,我将违规行几乎移到了列表的底部import sys import numpy as np from FatigueDialog import Ui_Dialog # in QtDesigner, using "Dialog" from FatigueKernel import * from FatigueInteractionCriteria import * from PyQt5 import QtCore, QtGui from PyQt5.QtGui import QIcon, QPixmap from PyQt5.QtGui import QDoubleValidator from PyQt5.QtWidgets import QDialog, QApplication, QListWidgetItem, QDialogButtonBox, QMessageBox
现在在FatigueDialog.py的第10行中失败,它来自主应用程序的第3行。这是第10行:

from PyQt5 import QtCore, QtGui, QtWidgets

所以,我知道cx-freeze无法获取PyQt5。在PyQt5的第一个实例上,它失败了。但是,如何修改setup.py以使其正常工作? 

ADDENDUM

为了简化我的帮助请求,我下载了cx开发人员Anthony Tuininga提供的示例代码。这是一个非常简单的应用程序PyQt5app.py,与setup.py一起使用,

sample code

我运行(venv375-32) python setup.py bdist_msi在我的开发机器上,使用Windows 10,Python 3.7.5-32位,PyQt5 5.13.2,PyQt5-sip 12.7.0。然后使用[] cx-freeze 6.0

python setup.py bdist_msi > PyQt5app_setup_log.txt

该版本在开发人员上运行良好。机。我将.msi复制到未安装PyQt5的计算机上。我安装了.msi,当我尝试运行它时,出现此错误:

File PyQt5app.py Line 5 in <module> import error DLL load failed: The specified module could not be found.

应用中的第5行是:from PyQt5.QtWidgets import QApplication, QWidget

似乎在目标计算机上PyQt5 DLL的安装失败,但是在安装过程中没有错误,仅在尝试运行该应用程序时出现。

<< [ADDED

一个链接,用于发布
的输出

python setup.py bdist_msi > PyQt5app_setup_log.txt

我使用cx-freeze 6.0。对于PyQt5app,我得到46208 KB的msi。它的大小足以容纳Python 3.7和PyQt吗?
PyQt5app_setup_log.txt

我如何修改setup.py,以便cx-freeze查找缺少的模块?这是我的setup.py:#用法:每个项目必须有自己的文件夹。 #python setup.py build->在项目上构建...

python-3.x pyqt5 cx-freeze
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.