首页 > 解决方案 > Pyinstaller 可执行文件找不到包含的发行版

问题描述

这是我的系统信息:

35 INFO: PyInstaller: 3.6
36 INFO: Python: 3.7.2
41 INFO: Platform: Darwin-19.6.0-x86_64-i386-64bit

我一直在尝试使用 Pyinstaller 生成 Python (Flask) 可执行文件以在应用程序中使用。但是,当我打包可执行文件并运行它时,它会抛出这个:

pkg_resources.DistributionNotFound: The 'pyonfleet' distribution was not found and is required by the application

这个依赖已经存在于我的虚拟环境中,从 Pyinstaller 的调试导入日志中,我可以看到以下几行:

import onfleet # PyInstaller PYZ
import onfleet.onfleet # PyInstaller PYZ
import 'onfleet.request' # <pyimod03_importers.FrozenImporter object at 0x7fbda00ab5f8>
import 'onfleet.endpoint' # <pyimod03_importers.FrozenImporter object at 0x7fbda00ab5f8>
import onfleet.config # PyInstaller PYZ
import 'onfleet.config' # <pyimod03_importers.FrozenImporter object at 0x7fbda00ab5f8>
import 'onfleet.onfleet' # <pyimod03_importers.FrozenImporter object at 0x7fbda00ab5f8>
import 'onfleet' # <pyimod03_importers.FrozenImporter object at 0x7fbda00ab5f8>

我已经尝试按照这里的建议添加一个钩子:https ://github.com/pyinstaller/pyinstaller/issues/4833但我仍然遇到同样的错误:(

标签: pythonpyinstaller

解决方案


推荐阅读