我将如何使用 py2exe 将 Beautiful soup 与我的代码一起捆绑到 exe 中?
我现在用于 setup.py 的代码是
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)
最佳答案
在您的选项
中,您可以添加属性includes
并以这种方式添加库。一个例子:
options = { "py2exe": {
"includes": ["LIBRARY HERE", ...]
}}
这包括 Py2exe 尚未找到的外部库。如果我没记错的话,Py2exe 应该尝试自己查找依赖项,如果找不到,您可以使用上述方法。
我不确定 Beautiful Soup 的库结构,因为我没有使用过它,但一个例子是:
“包含”:[“matplotlib.backends.backend_tkagg”]
关于python - 3rd 方库和 Py2exe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11770046/