python包管理工具uv

安装

参考: https://github.com/astral-sh/uv

安装python3.13: https://www.python.org/downloads/

安装到读写速度较快的盘: C:\Python313

删除系统和用户path中的WindowsApps路径,避免命令行输入python启动windows store:

%USERPROFILE%\AppData\Local\Microsoft\WindowsApps

删除后需要重新启动windows,阿三真不是东西,改的windows越来越臭。

安装uv :

python.exe -m pip install --upgrade pip
pip install uv

使用

参考: https://docs.astral.sh/uv/guides/projects/

初始化项目,会创建示例程序 main.py:

cd pyTest
uv init
Initialized project `pytest`

uv run main.py
Using CPython 3.13.2 interpreter at: C:\Python313\python.exe
Creating virtual environment at: .venv
Hello from pytest!

添加包:

uv add spyder
Resolved 171 packages in 260ms
error: Distribution `pyqt5-qt5==5.15.16 @ registry+https://pypi.org/simple` can't be installed because it doesn't have a source distribution or wheel for the current platform

hint: You're on Windows (`win_amd64`), but `pyqt5-qt5` (v5.15.16) only has wheels for the following platforms: `manylinux2014_x86_64`, `macosx_10_13_x86_64`, `macosx_11_0_arm64`

搜索: https://pypi.org/search/?q=pyqt5-qt5

查询了各个版本,支持windows-64 的最高版本是 5.15.2 :https://pypi.org/project/PyQt5-Qt5/5.15.2/#files

编辑文件 pyproject.toml

dependencies = [
    "pyqt5-qt5 <=5.15.2",
    "pyqtwebengine-qt5<=5.15.2",
]

执行 uv lock

uv lock
Resolved 3 packages in 945ms
Added pyqtwebengine-qt5 v5.15.2

重新安装:

set http_proxy=http://192.168.8.1:8118
set https_proxy=http://192.168.8.1:8118
uv add spyder

正文完
 0
评论(没有评论)