Qt6 QML Book/Qt for Python/安装过程
2022/2/4 9:12:26
本文主要是介绍Qt6 QML Book/Qt for Python/安装过程,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
Installing
安装过程
Qt for Python is available through PyPA using pip
under the name pyside6
. In the example below we setup a venv
environment in which we will install the latest version of Qt for Python:
PyPA使用名为pyside6的pip提供了用于Python的Qt。在下面的示例中,我们设置了一个venv环境,在其中我们将安装最新版本的Qt for Python:
mkdir qt-for-python cd qt-for-python python3 -m venv . source bin/activate (qt-for-python) $ python --version Python 3.9.6
When the environment is setup, we continue to install pyside6
using pip
:
环境设置完成后,我们将继续使用pip安装pyside6:
(qt-for-python) $ pip install pyside6 Collecting pyside6 Downloading [ ... ] (60.7 MB) Collecting shiboken6==6.1.2 Downloading [ ... ] (1.0 MB) Installing collected packages: shiboken6, pyside6 Successfully installed pyside6-6.1.2 shiboken6-6.1.2
After the installation, we can test it by running a Hello World example from the interactive Python prompt:
安装完成后,我们可以通过在交互式Python提示符下运行Hello World示例来测试它:
(qt-for-python) $ python Python 3.9.6 (default, Jun 28 2021, 06:20:32) [Clang 12.0.0 (clang-1200.0.32.29)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from PySide6 import QtWidgets >>> import sys >>> app = QtWidgets.QApplication(sys.argv) >>> widget = QtWidgets.QLabel("Hello World!") >>> widget.show() >>> app.exec() 0 >>>
The example results in a window such as the one shown below. To end the program, close the window.
该示例将生成一个如下所示的窗口。要结束程序,请关闭窗口。
这篇关于Qt6 QML Book/Qt for Python/安装过程的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-10-04Python外包有哪些常见的主要库-icode9专业技术文章分享
- 2024-10-02基于深度学习的钢铁缺陷检测系统(yolov8、注意力机制、PyQt5界面、Python)
- 2024-10-01怎么用python搭建一个系统-icode9专业技术文章分享
- 2024-09-30Python基础入门教程
- 2024-09-30获取参数学习:Python中的基础教程
- 2024-09-30Python编程基础详解
- 2024-09-29点击加载学习:Python编程基础教程
- 2024-09-29数据科学五大Python前端库:第二部分
- 2024-09-27使用python 将ETH账户的资产打散
- 2024-09-26Python编程基础