Python 3.6.x PyInstaller给出错误"没有名为'PyQt5.sip'的模块"

Joe*_*Doe 10 python sip pyinstaller pyqt5

我开发了一些在Python 3.5.4上运行良好的程序,但由于win32的一些错误让我进入Python 3.6.4,但是当我使用pyinstaller构建我的项目时,我得到:

C:\Users\User\Desktop\dist\mycommentator>mycommentator.exe
Traceback (most recent call last):
  File "mycommentator.py", line 6, in <module>
  File "c:\users\user\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 714, in load_module
    module = loader.load_module(fullname)
ModuleNotFoundError: No module named 'PyQt5.sip'
[1532] Failed to execute script mycommentator
Run Code Online (Sandbox Code Playgroud)

我试图重新安装python,所以我安装了Python 3.6.4/Python 3.6.5,这个错误也发生在我身上.无论我在PyQt5中构建什么代码,每次都出现此错误.

我也尝试移动sip.pyd到项目文件夹,但仍然发生错误.我也尝试过pip install --upgrade sip,但没有帮助.我也尝试安装pyinstaller的开发版本,这也没有帮助.

joh*_*shu 15

我有同样的问题,由于sip现在单独安装,显然是一个已知的错误.

https://github.com/pyinstaller/pyinstaller/issues/3630

在创建安装程序后,我添加了以下行:

--hidden-import PyQt5.sip

这没有问题.

  • 我通过卸载 pyinstaller 并安装 pyinstaller 的开发分支解决了丢失样式问题: `pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip` 非常感谢! (2认同)