首页 > 系统相关 >pyside6 qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""

pyside6 qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""

时间:2022-11-16 17:34:22浏览次数:45  
标签:qt plugin windows pyside6 path dirname os PySide6

报错

pyside6 qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""

解决方案

1. 将环境变量设置到 QT_QPA_PLATFORM_PLUGIN_PATH

1.1 如果不知道pyside6 在那个文件夹,可以通过以下方式获取

import os, PySide6
print(os.path.dirname(PySide6.__file__))

1.2 然后将打开系统环境变量

输入 QT_QPA_PLATFORM_PLUGIN_PATH, 路径为上述代码打印, 然后上述错误即可解决
image

2. 设置系统代码

import os, PySide6

dirname = os.path.dirname(PySide6.__file__)
print(dirname)
plugin_path = os.path.join(dirname, 'plugins', 'platforms')
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = plugin_path
print(plugin_path)

标签:qt,plugin,windows,pyside6,path,dirname,os,PySide6
From: https://www.cnblogs.com/han-guang-xue/p/16896678.html

相关文章