Py2Exe:缺少模块错误

2024-05-16 00:08:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经编写了一个使用SeleniumXmltoDict和{}的py脚本,在运行命令时遇到以下错误。如何包括它们?在

['Carbon', 'Carbon.Files', '_scproxy', '_sysconfigdata', 'builder.ParserRejected
Markup', 'builder.builder_registry', 'cchardet', 'chardet', 'defusedexpat', 'htm
l.parser', 'html5lib', 'html5lib.constants', 'http.client', 'iconv_codec', 'lxml
', 'ordereddict', 'urllib.parse', 'win32pipe', 'winreg']['Carbon', 'Carbon.Files', '_scproxy', '_sysconfigdata', 'builder.ParserRejected
Markup', 'builder.builder_registry', 'cchardet', 'chardet', 'defusedexpat', 'htm
l.parser', 'html5lib', 'html5lib.constants', 'http.client', 'iconv_codec', 'lxml
', 'ordereddict', 'urllib.parse', 'win32pipe', 'winreg']

我用的是Py27


Tags: parserbuilderfilesregistrycarbonmarkupconstantshtm
1条回答
网友
1楼 · 发布于 2024-05-16 00:08:45

py2exe会错过您需要的包而包含不需要的包的原因有很多。使用py2exe setup options可以帮你解决问题。在

在py2exe的设置中:

py2exe_options = {
    ...
    packages=['Selenium', 'XmltoDict', 'BeautifulSoup'],  # additional packages
    includes=[], # additional modules
    excludes=[], # exluded modules
    ...
}
setup(...,
      options = {
          ... 
          'py2exe': py2exe_options,
          ...
      },
      ...
)

相关问题 更多 >