python - 3rd 方库和 Py2exe

标签 python beautifulsoup exe py2exe

我将如何使用 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/

相关文章:

python - 使用正则表达式在网页中查找电子邮件地址

python - 变量赋值错误

python - 使用 beautifulsoup 提取 url 和标题

r - 如何使用R调用exe程序和输入参数?

c - 如何将资源从一个可执行文件复制到另一个可执行文件

Python自定义记录器不打印到控制台

python - Django:无法从模板中的设置呈现 STATIC_URL

python - 提取 Youtube 搜索结果时出现问题

python - 美汤-查找 child 标签属性内容

c# - exe 需要 .NET 桌面运行时