Third-party libraries and Py2exe

How can I collapse, say, a beautiful soup in exe along with my code using py2exe?

The code I use for my setup.py is now

from distutils.core import setup
import py2exe

# equivalent command line with options is:
# python setup.py py2exe --compressed --bundle-files=2 --dist-dir="my/dist/dir" --dll-excludes="w9xpopen.exe"
options = {'py2exe': {
           'compressed':1,  
           'bundle_files': 1, 
           'dist_dir': "exe/dist/dir"
           'dll_excludes'  }}

setup(console=[''], options=options,zipfile = None)
+1
source share
1 answer

In optionsyou can add an attribute includesand thus add libraries. Example:

options = { "py2exe": {
                "includes": ["LIBRARY HERE", ...]
          }}

This includes external libraries that Py2exe has not yet found. If I remember correctly, Py2exe should try to find dependencies on it, and any of them will not, you can use the above method.

I am not sure about the library structure for Beautiful Soup since I have not used it, but an example could be:

"includes": ["matplotlib.backends.backend_tkagg"]

+2
source

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


All Articles