building executable using python,vtk and py2exe
Is it possible to create a binary executable with py2exe for vtk?
Could someone provide a minimum working example or at least some hints? Py2exe is not necessary. If the开发者_运维技巧re is a working solution on other similar programs (bbfreeze etc) I am intrested too.
This example uses py2exe. Use packages to add any referenced libraries and options includes to add dependencies. I am not too sure about the exact semantics and I reached this stable configuration after much trial and error. Hopefully, you can use this as a template to go ahead.
from distutils.core import setup
import py2exe
import modulefinder
from iso8601 import iso8601
setup(name='exeExample',
version='1.0',
description='Exe example using py2Exe',
author='Urjit Singh Bhatia',
author_email='person@user.com',
packages=['example', 'someLib'],
console=['src\\a.py',
'src\\b.py',
'src\\c.py',
'src\\d.py'],
options={"py2exe":{"includes":["someLib","csv","iso8601","pymssql","uuid","decimal","urllib2","traceback","re","_mssql","os"]}}
)
Keep in mind that options, includes sometimes need to be nested. That means, if pymssql here uses _mssql, it was giving me an error saying that _mssql was missing, so I had to explicitly go and add that as a dependency.
I hope someone can improve and explain.
Edits: 1. Added imports. 2. Simply running this creates a folder called dist where you will see the exe(s) and the dependencies.
精彩评论