win7下用py2exe打包Pyqt4+matplotlib出错(python2.7)

tjzhaomengyi 发布于 2014/12/02 20:28
阅读 1K+
收藏 0
我用pyqt4做界面,里面嵌入了一个matplotlib显示图形的一个界面,现在用py2exe进行打包,打包完成后总是在嵌入的matplotlib显示错误,导致主界面也没法调用嵌入的界面,错误信息如下“Traceback (most recent call last):
  File "mpl_pyqt4_widget_scope.py", line 9, in <module>
  File "zipextimporter.pyc", line 82, in load_module
  File "matplotlib\backends\backend_qt4agg.pyc", line 17, in <module>
  File "zipextimporter.pyc", line 82, in load_module
  File "matplotlib\backends\backend_qt5agg.pyc", line 35, in <module>
  File "ctypes\__init__.pyc", line 378, in __getattr__
  File "ctypes\__init__.pyc", line 383, in __getitem__

AttributeError: function 'Py_DecRef' not found

在嵌入的matplotlib的图形界面用的是

from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4 import NavigationToolbar2QT as NavigationToolbar
定位到对应是这两句话有问题,求打包方法。

加载中
0
Feng_Yu
Feng_Yu

python2打包可以试试用pyinstaller https://github.com/pyinstaller/pyinstaller

似乎成功率比较高,py2exe没研究过,不过大家都说pyinstaller功能更强,以前有一个wxpython的项目用pyinstaller成功打包过。

tjzhaomengyi
tjzhaomengyi
thx,我之前想用pyinstaller的,结果看了一个博说不太推荐,又去用py2exe了,本来用py2exe已经打好一个纯pyqt4的没有matplotlib的,看来还得试试pyinstaller,谢谢了
返回顶部
顶部