Pyinstaller:'Fiona' 没有属性 '_loading'很可能是由于循环导入

问题描述

我真的需要帮助来处理这个问题。

我在 PyScripter 上运行我的脚本,一切正常,但是当我尝试使用 PyInstaller 将所有脚本捆绑到 .exe 中时,出现如下图所示的错误

enter image description here

我也尝试在我的虚拟环境中从 Anaconda 提示符运行,完全没有问题。

我该如何解决这个问题??

仅供参考,我还提供了我的 conda 信息。

enter image description here

以及我使用的所有软件包。

enter image description here

另外,我的代码片段(我不知道它是否相关)

enter image description here

下图应该是我要找的输出

enter image description here

感谢您的帮助,已经很多天了,我仍然无法解决这个问题。

解决方法

我不确定这能解决你的问题,但你可以试试我的方法。 我直接从 fiona 的 __init__ 文件中更改代码。

import fiona._loading 
with fiona._loading.add_gdal_dll_directories():

import _loading
with _loading.add_gdal_dll_directories():
,

尝试使用 cx_freeze 而不是 pyinstaller,它对我有用。