zhiyiYo / PyQt-Fluent-Widgets

A fluent design widgets library based on C++ Qt/PyQt/PySide. Make Qt Great Again.
https://qfluentwidgets.com
GNU General Public License v3.0
5.61k stars 541 forks source link

ImportError: DLL load failed: 找不到指定的程序。 #141

Closed keymou closed 1 year ago

keymou commented 1 year ago

Describe the bug ImportError: DLL load failed: 找不到指定的程序。

Environment

To Reproduce PyCharm create a virtualenvs to pip install PyQt-Fluent-Widgets :

  1. Go to run PyQt-Fluent-Widgets-PySide6\PyQt-Fluent-Widgets-PySide6\examples\button\demo.py
  2. See error

Code

# coding:utf-8
import sys

from PySide6.QtCore import Qt, QSize
from PySide6.QtWidgets import QApplication, QWidget, QVBoxLayout
from qfluentwidgets import ToolButton
from qfluentwidgets import FluentIcon as FIF

class Demo(QWidget):

    def __init__(self):
        super().__init__()

        self.toolButton = ToolButton(FIF.SETTING, self)
        self.vBoxLayout = QVBoxLayout(self)
        self.vBoxLayout.addWidget(self.toolButton, 0, Qt.AlignCenter)
        self.vBoxLayout.setSizeConstraint(QVBoxLayout.SetMinAndMaxSize)
        self.resize(400, 400)
        self.setStyleSheet('Demo{background:white}')

if __name__ == '__main__':
    app = QApplication(sys.argv)
    w = Demo()
    w.show()
    app.exec_()

Expected behavior

Traceback (most recent call last):
  File "D:\NetDevOps\python\PyQt-Fluent-Widgets-PySide6\PyQt-Fluent-Widgets-PySide6\examples\button\demo.py", line 6, in <module>
    from qfluentwidgets import ToolButton
  File "C:\Python36\lib\site-packages\shiboken6\files.dir\shibokensupport\__feature__.py", line 140, in _import
    return original_import(name, *args, **kwargs)
  File "D:\NetDevOps\python\PyQt-Fluent-Widgets-PySide6\PyQt-Fluent-Widgets-PySide6\qfluentwidgets\__init__.py", line 17, in <module>
    from .components import *
  File "C:\Python36\lib\site-packages\shiboken6\files.dir\shibokensupport\__feature__.py", line 140, in _import
    return original_import(name, *args, **kwargs)
  File "D:\NetDevOps\python\PyQt-Fluent-Widgets-PySide6\PyQt-Fluent-Widgets-PySide6\qfluentwidgets\components\__init__.py", line 1, in <module>
    from .dialog_box import *
  File "C:\Python36\lib\site-packages\shiboken6\files.dir\shibokensupport\__feature__.py", line 140, in _import
    return original_import(name, *args, **kwargs)
  File "D:\NetDevOps\python\PyQt-Fluent-Widgets-PySide6\PyQt-Fluent-Widgets-PySide6\qfluentwidgets\components\dialog_box\__init__.py", line 1, in <module>
    from .color_dialog import ColorDialog
  File "C:\Python36\lib\site-packages\shiboken6\files.dir\shibokensupport\__feature__.py", line 140, in _import
    return original_import(name, *args, **kwargs)
  File "D:\NetDevOps\python\PyQt-Fluent-Widgets-PySide6\PyQt-Fluent-Widgets-PySide6\qfluentwidgets\components\dialog_box\color_dialog.py", line 8, in <module>
    from ..widgets import Slider, ScrollArea, PushButton, PrimaryPushButton
  File "C:\Python36\lib\site-packages\shiboken6\files.dir\shibokensupport\__feature__.py", line 140, in _import
    return original_import(name, *args, **kwargs)
  File "D:\NetDevOps\python\PyQt-Fluent-Widgets-PySide6\PyQt-Fluent-Widgets-PySide6\qfluentwidgets\components\widgets\__init__.py", line 3, in <module>
    from .combo_box import ComboBox, EditableComboBox
  File "C:\Python36\lib\site-packages\shiboken6\files.dir\shibokensupport\__feature__.py", line 140, in _import
    return original_import(name, *args, **kwargs)
  File "D:\NetDevOps\python\PyQt-Fluent-Widgets-PySide6\PyQt-Fluent-Widgets-PySide6\qfluentwidgets\components\widgets\combo_box.py", line 8, in <module>
    from .menu import RoundMenu
  File "C:\Python36\lib\site-packages\shiboken6\files.dir\shibokensupport\__feature__.py", line 140, in _import
    return original_import(name, *args, **kwargs)
  File "D:\NetDevOps\python\PyQt-Fluent-Widgets-PySide6\PyQt-Fluent-Widgets-PySide6\qfluentwidgets\components\widgets\menu.py", line 2, in <module>
    from qframelesswindow import WindowEffect
  File "C:\Python36\lib\site-packages\shiboken6\files.dir\shibokensupport\__feature__.py", line 140, in _import
    return original_import(name, *args, **kwargs)
  File "C:\Python36\lib\site-packages\qframelesswindow\__init__.py", line 22, in <module>
    from .titlebar import TitleBar, TitleBarButton, SvgTitleBarButton, StandardTitleBar
  File "C:\Python36\lib\site-packages\shiboken6\files.dir\shibokensupport\__feature__.py", line 140, in _import
    return original_import(name, *args, **kwargs)
  File "C:\Python36\lib\site-packages\qframelesswindow\titlebar\__init__.py", line 12, in <module>
    from ..utils import startSystemMove
  File "C:\Python36\lib\site-packages\shiboken6\files.dir\shibokensupport\__feature__.py", line 140, in _import
    return original_import(name, *args, **kwargs)
  File "C:\Python36\lib\site-packages\qframelesswindow\utils\__init__.py", line 5, in <module>
    from .win32_utils import WindowsMoveResize as MoveResize
  File "C:\Python36\lib\site-packages\shiboken6\files.dir\shibokensupport\__feature__.py", line 140, in _import
    return original_import(name, *args, **kwargs)
  File "C:\Python36\lib\site-packages\qframelesswindow\utils\win32_utils.py", line 7, in <module>
    import win32api
  File "C:\Python36\lib\site-packages\shiboken6\files.dir\shibokensupport\__feature__.py", line 140, in _import
    return original_import(name, *args, **kwargs)
ImportError: DLL load failed: 找不到指定的程序。
zhiyiYo commented 1 year ago

试下我博客里面的方法:https://www.cnblogs.com/zhiyiYo/p/16340429.html

keymou commented 1 year ago

试下我博客里面的方法:https://www.cnblogs.com/zhiyiYo/p/16340429.html

将虚拟环境中site-packages/pywin32_system32目录下两个dll复制到system32下,不提示Import Error, 提示 ModuleNotFoundError: No module named 'dataclasses', qfluentwidgets\components\widgets\stacked_widget.py 引用dataclasses dataclasses是python3.7新增的,python版本3.6不支持。