从源码编译PyQt5的过程

在网上看了许多教程,都要安装sip模块再进行编译,但新的sip模块执行命令与之前有较大区别,最后还是看了官方文档才成功,下面把官方文档抄下面,做个记录。

1、安装编译工具

 

 

The solution to all these issues is to use the pyqt-bundle program to bundle a copy of your own Qt installation with your commercial PyQt5. This will produce a new wheel that you can distribute easily to your developers.

pyqt-bundle is part of PyQt-builder. To install it, run:

pip install PyQt-builder

The documentation can be found here.

To uninstall the commercial version, run:

pip uninstall PyQt5-commercial

Building PyQt5

Once you have downloaded the sdist from PyPI, unpack it and change directory to its top level directory (i.e. the one containing the pyproject.toml file.

If you are building the commercial version of PyQt5 then copy the pyqt-commercial.sip license file to the sip sub-directory.

To build and install PyQt5, run:

sip-install

In order to see all the available command line options, run:

sip-install -h

2、安装pyqt5-sip模块

Building the sip Module

It is not necessary to install the PyQt5.sip module before building PyQt5 but it must be installed before PyQt5 can be used.

The module is built using setuptools and is available from the PyQt5-sip project at PyPI. It uses setuptools as its build system and can be installed by pip or you can also unpack the sdist and install it by running its setup.py script.

 
posted @ 2026-05-06 14:51  swordzj  阅读(19)  评论(0)    收藏  举报