python 2.7 - Creating executable with Py2exe and matplotlib errors -
i have been searching forum , many others , cannot seem method of creating executable. have tried several different methods (py2exe, pyinstaller , cx_freeze) , seem give me kind of error.
when tried pyinstaller, received error "no _imaging c module installed". search says has pil, code not using pil.
when tried py2exe, keep receiving following error:
file "scout_tool.py", line 18, in <module> file "matplotlib\pyplot.pyc", line 95, in <module> file "matplotlib\backends\__init__.pyc", line 25, in pylab_setup importerror: no module named backend_qt4agg
i @ loss of do. code contains following imports:
import os import csv import wx import time import math matplotlib.backends.backend_wx import figurecanvaswx figurecanvas matplotlib.backends.backend_wx import navigationtoolbar2wx matplotlib.pyplot import figure,show mpl_toolkits.basemap import basemap matplotlib.figure import figure import matplotlib.pyplot plt numpy.random import rand datetime import datetime import wx.calendar cal import numpy npy pylab import * import numpy np import matplotlib import adodbapi import sqlparse import pylab import annote_new import cpickle pickle
does have suggestions on how build of executable using py2exe? have tried...
from distutils.core import setup import py2exe import matplotlib setup( windows=[{'script': r'scout_tool.py'}], data_files=matplotlib.get_py2exe_datafiles(), options={ r'py2exe': { r'includes': r'elementconfig', r'includes': r'colorconv', r'includes': r'tkinter', r'includes': r're', r'includes': r'math', r'includes': r'sys', r'includes': r'matplotlib', r'includes': r'mpl_toolkits', r'includes': r'matplotlib.backends.backend_wx', r'dll_excludes': [r'msvcp90.dll'], } }, )
thanks help!
i not sure fix problem, should start correcting faulty options
dictionary entry. in python, when define dictionary same key on , over, going last value. key can exist once:
options={ r'py2exe': { r'includes': r'elementconfig', ... r'includes': r'mpl_toolkits', r'includes': r'matplotlib.backends.backend_wx', ... } } print options #{'py2exe': {'includes': 'matplotlib.backends.backend_wx'}}
i suspect result of usage py2exe not finding of intended includes. includes
should list:
options={ 'py2exe':{ 'includes': [ 'elementconfig', 'colorconv', 'tkinter', 're', 'math', 'sys', 'matplotlib', 'mpl_toolkits', 'matplotlib.backends.backend_wx' ], 'dll_excludes': ['msvcp90.dll'], } },
if after this, still complains backend missing, can add explicit entry:
'includes': [ ... 'matplotlib.backends.backend_qt4agg' ],
Comments
Post a Comment