[Python] PySide6 and QML error: qtquick2plugin.dll: The specified module could not be found

Discussão em 'Python' iniciado por Stack, Março 2, 2025.

  1. Stack

    Stack Membro Participativo

    I use python version 3.11.1 in a virtual env and used pip install pyside6 to install pyside6

    The full error I get is:

    QQmlApplicationEngine failed to load component
    file:///E:/project_path/gui_pyside6/first_gui/virenv/src/main.qml:1:1: Cannot load library E:\project_path\gui_pyside6\first_gui\virenv\Lib\site-packages\PySide6\qml\QtQuick\qtquick2plugin.dll: The specified module could not be found.


    I have checked and qtquick2plugin.dll is in that folder. I even added the path to my environment paths, but nothing seems to solve it. How can I solve this?

    This is my main.py

    import sys

    from PySide6.QtGui import QGuiApplication
    from PySide6.QtQml import QQmlApplicationEngine

    app = QGuiApplication(sys.argv)

    engine = QQmlApplicationEngine()
    engine.quit.connect(app.quit)
    engine.load('main.qml')

    sys.exit(app.exec())


    This is my main.qml

    import QtQuick 2.15
    import QtQuick.Controls 2.15

    ApplicationWindow {
    visible: true
    width: 600
    height: 500
    title: "HelloApp"

    Text {
    anchors.centerIn: parent
    text: "Hello World"
    font.pixelSize: 24
    }

    }


    Platform: Windows 10

    Continue reading...

Compartilhe esta Página