一、介绍
最近使用树莓派做qt
程序,用的是python
语言,用python
语言进行qt
开发,使用PyQt5
或者PySide2
都可以,因PySide2
为qt官方维护,更稳定,所以使用PySide2
,PySide2
和PyQt5
很相似,使用PyQt5
写的程序,只要改一下库的导入,就可以快速切换到PySide2
开发。
二、问题
在Windows
系统上直接使用:
pip install pyside2
就可以安装PySide2
,但是在树莓派等Linux
系统下不行,这样会报错.
三、安装
1、安装PySide2
sudo apt-get install python3-pyside2.qt3dcore python3-pyside2.qt3dinput python3-pyside2.qt3dlogic python3-pyside2.qt3drender python3-pyside2.qtcharts python3-pyside2.qtconcurrent python3-pyside2.qtcore python3-pyside2.qtgui python3-pyside2.qthelp python3-pyside2.qtlocation python3-pyside2.qtmultimedia python3-pyside2.qtmultimediawidgets python3-pyside2.qtnetwork python3-pyside2.qtopengl python3-pyside2.qtpositioning python3-pyside2.qtprintsupport python3-pyside2.qtqml python3-pyside2.qtquick python3-pyside2.qtquickwidgets python3-pyside2.qtscript python3-pyside2.qtscripttools python3-pyside2.qtsensors python3-pyside2.qtsql python3-pyside2.qtsvg python3-pyside2.qttest python3-pyside2.qttexttospeech python3-pyside2.qtuitools python3-pyside2.qtwebchannel python3-pyside2.qtwebsockets python3-pyside2.qtwidgets python3-pyside2.qtx11extras python3-pyside2.qtxml python3-pyside2.qtxmlpatterns
2、安装shiboken2
sudo apt-get install shiboken2
3、其他问题
有时候安装失败可能是树莓派软件源里没有PySide2,需要换源,国内的很多源都可以,我一般使用的是清华大学的镜像源,给树莓派换清华源教程
PS:这种安装PySide2的方法对其它Linux也适用,经测试,在Ubuntu20.04、Ubuntu21.04、CentOS8系统上都可以正常安装,包括arm和x86架构。