gpt4 book ai didi

python - pyinstaller 创建 EXE 运行时错误 : maximum recursion depth exceeded while calling a Python object

转载 作者:IT老高 更新时间:2023-10-28 20:57:07 25 4
gpt4 key购买 nike

我正在运行 WinPython 3.4.4.3 和 pyinstaller 3.2(通过 pip install pyinstaller 获得)。

现在我有一些非常简单的 Qt4 代码,我想将其转换为 EXE,但我遇到了无法解决的问题。

守则:

import sys
import math
from PyQt4 import QtGui, QtCore
import SMui
import numpy as np
from scipy.interpolate import InterpolatedUnivariateSpline

class SomeCalculation(QtGui.QMainWindow, SMui.Ui_MainWindow):
def __init__(self):
super(self.__class__, self).__init__()
self.setupUi(self)
self.setWindowTitle('Some Calculation')
self.calculate.clicked.connect(self.some_math)

def some_math(self):
a_diameter=self.a_diameter.value()
b_diameter=self.b_diameter.value()
complement=self.complement.value()
angle=self.angle.value()
preload=self.preload.value()

### ONLY MATH HAPPENS HERE also defining X and Y ####

interpolator = InterpolatedUnivariateSpline(X, Y)

### MORE MATH HAPPENS HERE ####

self.axial.setText(str(axial))
self.radial.setText(str(radial))

def main():
app = QtGui.QApplication(sys.argv)
window=SomeCalculation()
window.show()
app.exec_()

if __name__=='__main__':
main()

我尝试运行 pyinstaller file_name.py 并得到:

RuntimeError: maximum recursion depth exceeded while calling a Python object

现在,如果我发现有一些事情也会影响问题:

1) 如果我注释掉这一行:from scipy.interpolate import InterpolatedUnivariateSpline

2) 从另一个使用 Scipy.Interpolate(RBS,但仍然)的不同脚本创建 EXE 文件 - 就像一个魅力。

3) 如果我尝试使用 WinPython 3.5.1.1 + pyinstaller 将其转换为 EXE,并且它是相同的 3.2 版本 - 它生成我的 exe 文件没有问题。

我想了解是什么导致了原始案例中的错误,不幸的是我在谷歌上找不到任何答案,我能找到的大多数修复都与 matplotlib 相关,而不是插值。

最佳答案

这对我有用

  1. 运行 pyinstaller 并停止它以生成规范文件:

    pyinstaller filename.py

    应该生成一个以.spec为扩展名的文件

  2. 现在将以下行添加到规范文件的开头:

    import sys
    sys.setrecursionlimit(5000)
  3. 现在运行规范文件:

    pyinstaller filename.spec

关于python - pyinstaller 创建 EXE 运行时错误 : maximum recursion depth exceeded while calling a Python object,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38977929/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com