2016-08-16 159 views
1

我使用pyinstaller 3.2(通过pip install pyinstaller获取)运行WinPython 3.4.4.3。pyinstaller创建EXE RuntimeError:调用Python对象时超出最大递归深度

现在我已经有一些非常简单的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相关,而不是插值。

+0

你有没有解决这个问题? – Eoin

回答

1

我想尝试增加递归深度限制。在你的文件的开头插入:

import sys 
sys.setrecursionlimit(5000) 
+0

是否做到了。没有帮助。 –

1

穆斯塔法的确引导我走向正确的方向,你必须增加递归限制。但是,代码必须付诸规范文件的开头,而不是在你的Python代码:

# -*- mode: python -*- 
import sys 
sys.setrecursionlimit(5000) 

pyi-makespec首先创建规范文件,编辑它,然后在规范文件传递到pyinstaller命令建立。有关using spec files的更多信息,请参阅pyinstaller手册。

请务必使用pyinstaller 3.2.0,3.2.1你会得到ImportError: cannot import name 'is_module_satisfies'(见GitHub上的issue

相关问题