在vscode中编写pyside环境配置
start
- 记录一下在 vscode 中编写 pyside6 程序,环境如何配置。
前提
- 请自行安装好 python。
- 请自行安装好 vscode。
- 安装 vscode 插件
Python
,PYQT Integration
。
配置环境
1.借助 pip 安装我们的pyside6
shell
pip install PySide6
2.找到我们安装的官方包
shell
# 1. 正常情况下,我们的依赖包都会安装在,python环境目录的,下方路径。
\Lib\site-packages\PySide6
# 如果找不到对应的目录文件怎么办?
## cmd 窗口
where python
# 或者
where pip
## powershell 窗口
Get-Command python
# 或者
pip show pip
cmd 窗口

powershell 窗口

3. 配置 PYQT Integration

总共需要配置三个路径
- rcc
- uic
- Qtdesigner
分别对应的路径(相对于环境目录)
\Scripts\pyside6-rcc.exe
\Scripts\pyside6-uic.exe
\Lib\site-packages\PySide6\designer.exe

4.如何使用 PYQT Integration?
在文件目录右键,即可看到:PYQT-new form
。右击ui文件可以编译或新增。

end
好了,到这里配置就完成了。
思考
我们配置插件的路径,这些 exe 程序有什么作用呢 ?
-
pyside6-uic.exe 用于将.ui文件转换为Python代码。
-
pyside6-rcc.exe 用于将.qrc文件编译成Python代码。
-
designer.exe 用于创建图形用户界面。