个人技术分享

一、安装pyside2

pip install pyside2

二、配置qtdesigner

File->Settings->Tools->External tools

点击添加,添加QtDesigner, 注意designer.exe路径,需要在虚拟环境下。

三、添加pySide2

File->Settings->Tools->External tools

点击添加,添加PySide2, 注意uic.exe路径,需要在虚拟环境下。

E:\src\gat1400\venv\Scripts\pyside2-uic.exe

$FileName$ -o $FileNameWithoutExtension$.py

$FileDir$

四、使用pydesigner设计界面

tools->external tools

五、使用pyside2将ui界面转换为代码

左侧选中相应的gat1400.ui文件,然后使用Pyside2将其转换为gat1400.py文件

六、注意事项

python版本需要大于3.8.0(3.8.0会报错),安装的版本3.8.0会报错,需要大于3.8.0

Traceback (most recent call last):
  File "D:/xxx.py", line 10, in <module>
    from PySide6.QtWidgets import QApplication, QWidget
  File "D:\Envs\pyside6\lib\site-packages\PySide6\__init__.py", line 124, in <module>
    _setupQtDirectories()
  File "D:\Envs\pyside6\lib\site-packages\PySide6\__init__.py", line 64, in _setupQtDirectories
    from shiboken6 import Shiboken
  File "D:\Envs\pyside6\lib\site-packages\shiboken6\__init__.py", line 27, in <module>
    from shiboken6.Shiboken import *
ImportError: DLL load failed while importing Shiboken: 找不到指定的程序。