Raspberry pi配置python + pyside2环境

1、更换raspberry pi的软件源

cd /etc/apt/
//备份raspberry pi的源
mv sources.list sources.list.backup
//新建源
vim sources.list

2、查看阿里源的树莓派地址https://developer.aliyun.com/mirror/raspbian?spm=a2c6h.13651102.0.0.3e221b11Ifdx3o

写入以下内容,更换软件源成功

deb https://mirrors.aliyun.com/raspbian/raspbian/ buster main non-free contrib
deb-src https://mirrors.aliyun.com/raspbian/raspbian/ buster main non-free contrib

3、升级树莓派

sudo apt update
sudo apt upgrade

4、升级python3 的pip3

pip3 install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple/

查看升级好的pip3的版本

pip3 -V

PS:这里如果提示有警告的化,进入/usr/local/bin文件下查看,有可能新装的pip被命令为其他的,比如pip3.7或者pip3.6,我这里的被修改为了pip3.7 查看版本pip3.7 -V

5、安装pyside2

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 python3-pyside2uic

6、安装打包工具pyinstaller

pip3 install PyInstaller

7,使用pyinstaller打包pyside2的工程就可以了

注意:如果需要用到shiboken2,在进行打包的时候会提示 hidden import ‘shiboken2’ not found,可以去这里下载https://archlinuxarm.org/packages/armv7h/python-shiboken2

将下载的文件解压,在解压的路径usr/lib/python3.8/site-packages下面,复制shiboken2到python的dist-packages目录下,一般路径为/usr/local/lib/python3.x/dist-packages

原创文章 17 获赞 1 访问量 1501

猜你喜欢

转载自blog.csdn.net/mankaichuang/article/details/105876709