pyinstaller打包PyQt5遇到ImportError: DLL load failed while importing QtCore:

在用pyinstall打包包含PyQt的程序时遇到了ImportError: DLL load failed while importing QtCore
代码运行的时候没有问题,可以正常运行,但是打包完会出现QtCore调用失败的问题。

这是程序导入的代码
import sys
import os
if hasattr(sys, 'frozen'):
    os.environ['PATH'] = sys._MEIPASS + ";" + os.environ['PATH']
from PyQt5 import QtCore, QtGui, QtWidgets
这是用cmd运行打包好的exe程序时提示的错误
torchvision\io\image.py:13: UserWarning: Failed to load image Python extension:
torch\_jit_internal.py:751: UserWarning: Unable to retrieve source for @torch.jit._overload function: <function _DenseLayer.forward at 0x0000023157AFC3A0>.
  warnings.warn(f"Unable to retrieve source for @torch.jit._overload function: {func}.")
torch\_jit_internal.py:751: UserWarning: Unable to retrieve source for @torch.jit._overload function: <function _DenseLayer.forward at 0x0000023157AFC5E0>.
  warnings.warn(f"Unable to retrieve source for @torch.jit._overload function: {func}.")
Traceback (most recent call last):
  File "GUIStapleDetect.py", line 25, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
  File "StapleDetect.py", line 13, in <module>
ImportError: DLL load failed while importing QtCore: The specified procedure could not be found.
[25576] Failed to execute script 'GUIStapleDetect' due to unhandled exception!

尝试过把pyqt的路径加入环境变量的路径,也试过更新pyinstaller的版本,都没有解决问题,期待能帮忙解答一下,非常感谢

您好,请问您解决了吗?如果解决了的话方便告知一下解决方法吗,非常感谢

代码打包发来我试试,你这也发个这谁能知道