macOS(Ventural 13.1)环境下PyCharm中p

2023-01-27  本文已影响0人  望江樵夫

1、创建conda虚拟环境

conda create -n env_name python=3.9

2、安装PyQt5

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ pyqt5
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ pyqt5-tools

3、在pycharm中配置外部工具

$PyInterpreterDirectory$/../lib/python3.9/site-packages/qt5_applications/Qt/bin/Designer.app/Contents/MacOS/Designer

Arguments:

$FileName$

Working directory:

$ProjectFileDir$

Program:

$PyInterpreterDirectory$/pyuic5

Arguments:

$FileName$ -o $FileNameWithoutExtension$.py -x

Working directory:

$FileDir$

Program:

$PyInterpreterDirectory$/pyrcc5

Arguments:

$FileName$ -o $FileNameWithoutExtension$_rc.py

Working directory:

$FileDir$

4、使用方法

在对应的文件上右键->External Tools-> QtDesigner


例如编辑ui文件

5、错误解决

macOS下运行pyqt应用出现如下错误:


qt.qpa.fonts: Populating font family aliases took 352 ms. Replace uses of missing font family "Roboto" with one that exists to avoid this cost.

缺少开发使用的Roboto字体,下载安装 Google Roboto 字体即可!
如何在 Windows、Mac 和 Linux 上安装 Google Roboto 字体

上一篇 下一篇

猜你喜欢

热点阅读