You need to enable JavaScript to run this app. Windows 10下PySide6(Qt6 for Python) QtQml/QtQuick模块加载异常问题
优惠活动
大模型
产品
解决方案
定价
更多

Windows 10下PySide6(Qt6 for Python) QtQml/QtQuick模块加载异常问题

Win10下PySide6 QML示例无法正常运行问题

环境基础信息

  • 设备系统:Windows 10
  • Python版本:3.8.6
  • 运行环境:单独创建的Python虚拟环境

环境配置流程

  • 创建并激活虚拟环境的执行命令:
    python3 -m venv venv
    .\venv\Scripts\Activate.ps1
    
  • 虚拟环境内安装PySide6:全程无告警,安装流程正常
  • 基础功能验证:用QApplication和QLabel写的非QML Hello World示例可以正常运行

异常复现情况

跑官方教程里的QML示例时无法正常启动,具体代码如下:

代码文件

main.py

from PySide6.QtWidgets import QApplication
from PySide6.QtQuick import QQuickView
from PySide6.QtCore import QUrl

app = QApplication([])
view = QQuickView()
url = QUrl("view.qml")

view.setSource(url)
view.show()
app.exec_()

view.qml

import QtQuick 2.0

Rectangle {
    width: 200
    height: 200
    color: "green"

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

运行时报错内容

file:///C:/github/aorcl/python-gui-2/view.qml:1:1: Cannot load library C:\github\aorcl\python-gui-2\venv\lib\site-packages\PySide6\qml\QtQml\WorkerScript\workerscriptplugin.dll: The specified module could not be found.
     import QtQuick
     ^
file:///C:/github/aorcl/python-gui-2/view.qml: Failed to load dependencies for module "QtQml" version 6.0
file:///C:/github/aorcl/python-gui-2/view.qml: Failed to load dependencies for module "QtQuick" version 6.0

已核验的信息

手动检查过,报错提示找不到的workerscriptplugin.dll实际就在报错信息标注的路径下,不是文件缺失导致的问题,目前不清楚还有什么环节会引发加载失败,需要协助排查。

内容的提问来源于stack exchange,提问作者Alexey Dolganov

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.11.12 07:36:05