【问题标题】:Error during exe file run however .py file is running wellexe文件运行期间出错但是.py文件运行良好
【发布时间】:2019-12-21 15:44:30
【问题描述】:

我使用供应商支持库在 python 2.7 中开发了一个代码。使用 python 2.7 的原因是 require 库位于 python 2 环境中。从 IDLE 执行代码后,虽然安装程序生成的 .exe 文件出错,但它运行良好。谁能帮我解决这个问题。

创建exe文件的环境如下: 包版本


enm-client-scripting 1.18.1 点 18.1 PyInstaller 3.5

运行 exe 文件时出现错误,并且在导入以下库的位置产生错误。

Traceback(最近一次调用最后一次): 文件“ENM_GUI.py”,第 8 行,在 文件“c:\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py”, 第 395 行,在 load_module 中

Traceback(最近一次调用最后一次): 文件“ENM_GUI.py”,第 8 行,在 上面的行给出了错误,并且在这一行中实际导入了 enmscripting 库。将导入选项从一行移到另一行(显然在执行实际代码之前)以重现错误并发现此特定导入导致问题。

【问题讨论】:

    标签: python-2.7 pyinstaller


    【解决方案1】:

    我经常使用 pyinstaller,虽然您的帖子有些模棱两可,但听起来您的 pyinstaller 找不到该模块。根据 pyinstaller 文档,您可以做的事情很少:https://pyinstaller.readthedocs.io/en/stable/when-things-go-wrong.html

    1) 扩展模块路径:https://pyinstaller.readthedocs.io/en/stable/when-things-go-wrong.html#extending-the-path

    2) 列出隐藏的导入:https://pyinstaller.readthedocs.io/en/stable/when-things-go-wrong.html#listing-hidden-imports

    3) 扩展包路径:https://pyinstaller.readthedocs.io/en/stable/when-things-go-wrong.html#extending-a-package-s-path

    【讨论】:

      猜你喜欢
      • 2021-06-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-28
      • 2021-04-22
      • 2021-06-16
      • 1970-01-01
      相关资源
      最近更新 更多