Creating executable file using python, vtk and py2exe

Is it possible to create a binary executable with py2exe for vtk?

Can someone provide a minimal working example or at least some hints? Py2exe is not required. If there is a working solution for other similar programs (bbfreeze, etc.), I am also interested.

+6
source share
1 answer

This example uses py2exe. Use packages to add any referenced libraries, and options include adding dependencies. I'm not too sure about the exact semantics, and I have achieved this stable configuration after much trial and error. Hope you can use this as a template to continue.

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 sometimes need to be nested sometimes. This means that if pymssql uses _mssql here, it gave me an error saying that _mssql is missing, so I had to explicitly go over and add this as a dependency.

I hope someone can improve and explain.

edits: 1. Added import. 2. Simple execution creates a folder called dist, where you will see exe and dependencies.

+2
source

Source: https://habr.com/ru/post/894976/


All Articles