Deepin下搭建pyqt5开发环境——基于vscode

1.安装pyqt5

sudo apt-get install pyqt5*

2.安装QT5开发工具,里面包含了Qt Designer等工具

sudo apt-get install qttools5-dev-tools

3.打开vscode,搜索pyqt,安装PYQT Integration插件

4.点击小齿轮-->扩展设置,对PYQT Integration插件进行设置

5.在Pyqt-integration › Qtdesigner: Path中,增加QT designer的路径

/usr/lib/x86_64-linux-gnu/qt5/bin/designer

 

这样完成了对Deepin下pyqt5开发环境的搭建

可能出现的错误提示:

错误提示1

Error: Command failed: "pyuic5" -p "/home/nexfia/Documents/PyQt5 Project/PDFDecryptionTool/WinUI.ui"

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" 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.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.

Aborted

错误提示2

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" 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.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.

错误提示1是使用PYQT Integration插件对.ui文件进行预览时提示的。

错误提示2时python程序导入了pyqt5,运行程序时提示的

这2个错误的原因在于你装了多个pyqt5

一个可能是使用 pip 安装了一个

pip3 install pyqt5

另一个可能是使用我上面的命令安装了一个

sudo apt-get install pyqt5*

导致不知道用那个xcb

解决方法是将使用pip安装的pyqt5卸载掉

pip3 uninstall pyqt5
原文地址:https://www.cnblogs.com/syxy/p/14721832.html