我一直在尝试打包一个需要gino-starlette
. 我尝试将要求作为隐藏导入命令包含在内,
pyinstaller --hidden-import gino_starlette --hidden-import gino.ext --noconfirm windows_runner.py --clean
但无济于事,日志显示找到了 gino_starlette,但运行可执行文件会出现相同的错误。
运行可执行文件时记录:
Traceback (most recent call last):
File "gino\ext\__init__.py", line 72, in find_spec
ImportError: Cannot import gino.ext.starlette - is gino-starlette a valid extension and installed?
抛出特定错误的一段代码(位于 gino.ext 中,它加载 gino 所需的所有扩展):
def find_spec(self, fullname, path, target=None):
target = self._redirects.get(fullname)
if target:
mod = sys.modules.get(target)
if mod is None:
spec = find_spec(target)
spec.loader = _GinoExtensionCompatProxyLoader(fullname, spec.loader)
return spec
else:
return ModuleSpec(fullname, _GinoExtensionCompatNoopLoader(mod))
elif fullname.startswith(__name__):
raise ImportError(
"Cannot import {} - is gino-{} a valid extension and installed?".format(
fullname, fullname[len(__name__) + 1 :]
)
)
(我将这段代码包含为https://pyinstaller.readthedocs.io/en/stable/when-things-go-wrong.html#listing-hidden-imports说我应该将它包含在隐藏导入中,我做过)
我应该如何继续调试问题?