Window10/Window11下pycharm使用Conda配置pyQT5 + pyUIC + pyRCC

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档


PyQt5环境配置

1. conda 创建虚拟环境

1. 1 create a new virtual environment with specific python version (take python=3.8 as the example)

  • Open command prompt in windows (recommend to run as administrator)

image.png
image.png

  • Input the following command (py38 is the user-defined environment name):

conda create -n py38 python=3.8

  • Activate the installed environment

conda activate py38
image.png

2 install pyQT5 and pyQT5-tools

pip install pyqt5
pip install pyqt5-tools

3. Verify the installation of pyQT5

  • Type python in the command line to enter python environment
  • input the following code to test wheter the pyqt is successfully installed

from PyQt5.QtWidgets import QApplication, QDialog
image.png

  • if no error appear, it works

4. Configurate QT Designer, pyUIC and pyRCC in pycharm

  • QT designer provide a graphic interface to speed up the UI design
  • PyUIC is used to convert .ui file to .py file
  • PyRCC is used to convet figures, data. i.e. other resources to .py file

4.1 Open Pycharm, navigate to File -> Settings -> External Tools

4.2 Add Qt Designer

  • look up the designer.exe in the py38 virtual environment folder, it should locate at

…\anaconda3\envs\py38\Lib\site-packages\qt5_applications\Qt\bin\designer.exe
image.png

  • configuration
  • Name: QtDesigner (user-defined)
  • Arguments: $FileDir$\$FileName$
  • Woring directory: $FileDir$

4.3 Add pyuic5

  • look up the pyuic5.exe in the py38 virtual environment folder, it should locate in

…\anaconda3\envs\py38\Scripts\pyuic5.exe
image.png

  • Configuration
  • Name: PyUic (user-defined)
  • Arguments: $FileName$ -o $FileNameWithoutExtension$.py
  • Woring directory: $FileDir$

4.3 Add pyrcc5

  • look up the pyuic5.exe in the py38 virtual environment folder, it should locate in

…\anaconda3\envs\py38\Scripts\pyrcc5.exe
image.png

  • Configuration
  • Name: PyUic (user-defined)
  • Arguments: $FileName$ -o $FileNameWithoutExtension$.py
  • Woring directory: $FileDir$
  • 40
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值