Мне сложно найти рецепты py2exe, особенно для случаев, требующих c-расширений.build python program with extensions using py2exe
Следующий рецепт отлично работает без части «ext_modules». С его помощью я получаю «NameError: название 'Расширение' не определен
from distutils.core import setup
import py2exe
import matplotlib
import os
s = os.popen('svnversion')
version = s.read()
f = open('cpa_version.py', 'w')
f.write('VERSION = "%s"\n'%(version.strip()))
f.close()
setup(console=['cpa.py'],
options={
'py2exe': {
'packages' : ['matplotlib', 'pytz', 'MySQLdb', 'pysqlite2'],
'includes' : ['PILfix', 'version'],
"excludes" : ['_gtkagg', '_tkagg',
"Tkconstants","Tkinter","tcl"],
"dll_excludes": ['libgdk-win32-2.0-0.dll',
'libgobject-2.0-0.dll',
'libgdk_pixbuf-2.0-0.dll',
'tcl84.dll', 'tk84.dll']
}
},
data_files=matplotlib.get_py2exe_datafiles(),
# how to build _classifier.c???
ext_modules = [Extension('_classifier',
sources = ['_classifier.c'],
include_dirs=[numpy.get_include()],
libraries = ['sqlite3'])]
)
_classifier.c включает в себя следующие
#include "sqlite3.h"
#include "Python.h"
#include "numpy/arrayobject.h"
#include <stdio.h>
любая помощь будет принята с благодарностью