首先安装PyQt6和PyQt6-tools。使用如下命令:

pip install PyQt6 PyQt6-tools

但是运行后会报如下错误:

这个时候按照提示执行命令升级pip即可

python.exe -m pip install --upgrade pip

配置pycharm:

打开pycharm,进入setting,到如下位置:

首先添加pyqt6-tools.exe到pycharm

Name:QtDesigner

Group:PYQT6

Program:D:\Program Files\python3.9\Scripts\pyqt6-tools.exe(自己安装的python路径)

Arguments:designer

Working directory:$FileDir$

然后添加pyuic6.exe:

Name:Pyuic

Group:PYQT6

Program:D:\Program Files\python3.9\Scripts\pyuic6.exe(自己安装的python路径)

Arguments:$FileName$ -o $FileNameWithoutExtension$.py

Working directory:$FileDir$

配置完成后,可以在界面看到: