exe文件运行时出错,但是.py文件运行良好

时间:2019-08-15 06:27:19

标签: python-2.7 pyinstaller

我已经使用供应商专有库在python 2.7中开发了代码。使用python 2.7的原因是require库位于python 2环境中。从IDLE执行代码后,尽管由安装程序生成的.exe文件给出错误,但它运行良好。谁能帮我解决问题。

用于创建exe文件的环境如下: 套件版本


enm-client-scripting 1.18.1 点18.1 PyInstaller 3.5

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

回溯(最近通话最近):   文件“ ENM_GUI.py”,第8行,在   文件“ c:\ python27 \ Lib \ site-packages \ PyInstaller \ loader \ pyimod03_importers.py”,  在load_module中的第395行

回溯(最近通话最近):   文件“ ENM_GUI.py”,第8行,在 上面的行给出了错误,并且在这一行中实际上是导入脚本库。将导入选项从一行移到另一行(显然在执行实际代码之前)来重现该错误,并发现此垂直导入引起了问题。

1 个答案:

答案 0 :(得分:0)

我经常使用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

相关问题