PySide2的环境配置

为了学习Qt,同时公司要求用python,主要使用PyQt5

但是未来还想要去完成一些商业项目,考虑到PyQt5对于商业化其实不太友好使用了GPL协议,使用PySide2进行学习,还想要学习QML这种特别的UI布置方式。

为了使用Qt Design Studiio 而下载了QtCreator。主要使用VSCode进行开发,我使用了Anaconda进行python环境配置的。

 

在利用pip 安装PySide2后出现

 

qt.qpa.plugin: Could not load the Qt platform plugin "windows" in "" even though it was found.

This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

 

dirname = os.path.dirname(__file__)
envpath = os.path.join(dirname,'plugins','platforms')
os.environ["QT_QPA_PLATFORM_PLUGIN_PATH"] = envpath

 

 

建立的helloword后面又出现下列问题

 

QQmlApplicationEngine failed to load componentfile:///**********/main.qml:1:1: plugin cannot be loaded for module "QtQuick": Cannot protect module QtQuick 2 as it was never registered

 

用pip重新安装也没有办法,最后没有办法pip uninstall 它,用conda install pyside2来对环境进行安装

 

 

 

posted @ 2022-05-13 20:01  受安隐乐  阅读(495)  评论(0)    收藏  举报