Pyforms、pysettings 和 pyinstaller,对象没有属性“settings”

问题描述 投票:0回答:1

编译为可执行文件后,我在 python 2.7 中遇到 pyforms 和 pysettings 问题。

当“python godziny.py”执行时,脚本运行正常,没有错误。

但是,在我创建可执行文件后(目前我使用 pyinstaller,但我也尝试了 py2exe 和 cx_freeze 遇到同样的问题),我启动应用程序并收到以下内容:

C:\...>dist\godziny\godziny.exe
Traceback (most recent call last):
    File "godziny.py", line 10, in <module>
        from   pyforms          import BaseWidget
    File "c:\users\...\appdata\local\temp\pip-build-hzzm3w\pyinstaller\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
    File "site-packages\pyforms\__init__.py", line 6, in <module>
    File "site-packages\pysettings\settings_manager.py", line 22, in __add__
    File "site-packages\pysettings\settings_manager.py", line 16, in __load_module
AttributeError: 'module' object has no attribute 'settings'
Failed to execute script godziny

我使用的是Python 2.7,带有来自 Pysettings 的 pysettings 和来自 pip (0.1.7.3) 的 pyforms。 Pyinstaller 在编译过程中不会报告任何错误。

python-2.7 pyinstaller pyforms
1个回答
0
投票

我在面临完全相同的问题时偶然发现了你 7 年前的问题。在谷歌搜索各个页面后,我终于在第一次尝试中找到了对我有用的解决方案,所以这是我的小解决方案:

您需要从此处复制挂钩文件并将其移动到您的 Pyinstaller 站点包中。就是这样。

您现在可以创建 exe,一切都应该运行得很好。

希望这个小解决方案能够为那些在隧道尽头寻找光明的人提供及时的帮助。

© www.soinside.com 2019 - 2024. All rights reserved.