资源
正文
配置环境
在项目目录下:
uv venv .venv
.venv\Scripts\activate
uv pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyside6Resolved 4 packages in 3.68s
Prepared 4 packages in 2m 40s
░░░░░░░░░░░░░░░░░░░░ [0/4] Installing wheels... warning: Failed to hardlink files; falling back to full copy. This may lead to degraded performance.
If the cache and target directories are on different filesystems, hardlinking may not be supported.
If this is intentional, set `export UV_LINK_MODE=copy` or use `--link-mode=copy` to suppress this warning.
Installed 4 packages in 5.33s
+ pyside66.9.2
+ pyside6-addons6.9.2
+ pyside6-essentials6.9.2
+ shiboken66.9.2
快速开始
main.py 里放:
import sys
from PySide6.QtWidgets import QApplication, QLabel
app = QApplication(sys.argv)
label = QLabel("Hello, PySide6 + uv!")
label.show()
sys.exit(app.exec())得到小小的也很可爱:
PyInstaller 打包
执行命令:
uv pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyinstaller
.venv\Scripts\activate
pyinstaller --onefile --windowed main.py注意
-
--onefile:打包成单个可执行文件(否则会生成一堆依赖文件夹)。 -
--windowed:GUI 模式,不会弹出终端黑框(Windows 上有效)。
得到 dist/main.exe,45333kb……
PyQt-Fluent-Widgets
下载其中的 PySide6 分支。
uv venv .venv
.venv\Scripts\activate
uv pip install -r requirements.txt
uv pip install PySide6-Fluent-Widgets -i https://pypi.org/simple/跑一下:
cd examples/gallery
python demo.py美得很:
