我对这个问题做了一些搜索,人们抱怨可执行文件大小为30mb ~ 100mb,但出于某种原因,我的文件大小是300mb。我可能错了,但我认为这不正常。我尝试使用其他替代方案,比如cx_Freeze,但结果相同。这是我的项目中包含的内容:
from PyQt5 import QtCore, QtGui, QtWidgets
from pyplot import functions as plot
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
window = QtWidgets.QDialog()
ui = Ui_Dialog()
ui.setupUi(window)
window.show()
sys.exit(app.exec_())
pyplot是我项目中的另一个Python文件,其中包括:
from numpy import power, cbrt, sin, cos, arange
from matplotlib import pyplot as plt
from matplotlib import patches as pts
from scipy import integrate as intg
我使用这个命令来创建我的可执行文件:
pyinstaller --onefile --windowed montecarlo.py
感谢您的帮助
import
的所有内容都会被打包进可执行文件中,因此导入的包越大,最终程序的大小就越大。 - ForceBru