繁体   English   中英

带有 Pyinstaller 的 PySide2:无法执行脚本 pyi_rth_pkgres

[英]PySide2 with Pyinstaller: Failed to execute script pyi_rth_pkgres

所以过去几个月我一直在使用 Pyinstaller 将我的应用程序打包和分发为单个 exe 文件,但是我最近从在我的 GUI 应用程序中使用 Tkinter 切换到使用 PySide2(QT5 Wrapper)。 问题是,我无法打包这些可执行文件,因为我在运行时收到以下错误:

Exception: [Errno 2] No such file or directory: 'C:\\support\\signature\\loader.py'
Traceback (most recent call last):
  File "pyscript", line 23, in bootstrap
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\support\\signature\\loader.py'
AttributeError: module 'signature_loader' has no attribute 'pyside_type_init'
SystemError: could not initialize part 2

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "PyInstaller\loader\rthooks\pyi_rth_pkgres.py", line 11, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "C:\Users\felip\AppData\Roaming\Python\Python37\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "pkg_resources\__init__.py", line 33, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "C:\Users\felip\AppData\Roaming\Python\Python37\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "platform.py", line 116, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "C:\Users\felip\AppData\Roaming\Python\Python37\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "subprocess.py", line 50, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "C:\Users\felip\AppData\Roaming\Python\Python37\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "signal.py", line 45, in <module>
  File "c:\program files\python37\lib\functools.py", line 54, in update_wrapper
    value = getattr(wrapped, attr)
SystemError: <method-wrapper '__get__' of getset_descriptor object at 0x0000023A7ACE88B8> returned a result with an error set
[9240] Failed to execute script pyi_rth_pkgres

该包应包含一个 .py 文件、一个 .uic QT 文件和一个 SQLite3 .db 。

我曾尝试以多种方式使用 Pyinstaller 进行打包,但是在尝试执行应用程序时会出现相同的异常。

我正在使用 Python 3.7.2、Pyinstaller 3.4、PySide 5.12.1 和 peewee 3.9.2。

任何帮助是极大的赞赏。

以下对我有用:
1. 卸载 pyinstaller 并从 git 安装开发者版本(但到目前为止没有改变任何东西 - 也许这不是必要的)
2. 输入pyinstaller -v example.pyw
3. 使用 2 的返回值作为隐藏导入。 在我的情况下pyinstaller --hidden-import=4.0.dev0+869062597f example.pyw

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM