3rd Party Libraries and Py2exe

匿名 (未验证) 提交于 2019-12-03 02:35:01

问题:

How would I go about bundling, say, Beautiful soup into an exe along with my code using py2exe?

The code I am using for my setup.py right now is

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:

In your options you can add an attribute includes and add the libraries that way. An example:

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

This includes external libraries that haven't already been found by Py2exe. If I remember correctly, Py2exe should try to find the dependencies on it's own and any it doesn't find you can use the above method.

I'm not sure about the library structure for Beautiful Soup as I've not used it, but an example would be:

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



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!