UV_PYTHON_INSTALL_MIRRORuv sync、uv venv、uv python install这几个命令都会安装一个python。这个python的安装包会从astral-sh/python-build-standalone/releases这里下载。但是对于国内的一些位置,从这里下载python的速度非常慢,有些地方根本访问不了。一个比较简单的
然后在本地建一个目录,比如/mnt/workspace/uv_python_install_mirror/20250409,然后将上述压缩包放入这个目录,然后将环境变量UV_PYTHON_INSTALL_MIRROR设置成这个目录,这样就uv就会去这个目录里面找压缩包,然后快速安装python了。比如export UV_PYTHON_INSTALL_MIRROR=file:///mnt/workspace/uv_python_install_mirror/202...
# 安装指定 Python 版本(自动下载并配置)$env:UV_PYTHON_INSTALL_MIRROR="https://gh-proxy.com/github.com/indygreg/python-build-standalone/releases/download"uvpythoninstall3.13.2# 查看已安装和可安装的Python版本uvpythonlist# 使用特定版本运行脚本uvxpython@3.13.2-c"print('hello world')" 关于镜像,也...
uv 现在能够安装和管理 Python 本身,使其完全自引导: $ curl -LsSf https://astral.sh/uv/install.sh | sh $ uv python install 3.12 如果你的机器上没有安装 Python,或者缺少特定的、所需的 Python 版本,除了显式调用uv python外,uv 还可以根据需要,自动下载所需的 Python 版本(如uv run、uv venv等命令...
❯ env UV_PYTHON_INSTALL_MIRROR=https://magic.com/py uv python install pypy3.10 -vv 0.000351s DEBUG uv uv 0.4.18 0.000911s DEBUG uv_fs Acquired lock for `/Users/x/Library/Application Support/uv/python` Searching for Python versions matchi...
uv是由Astral团队开发的Rust编写的Python打包工具,以极速和兼容性著称,可替代pip、venv等工具,支持依赖解析、虚拟环境管理,提升开发效率。
[tool.uv] index-url = "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple" 这种方法适用于项目级别的镜像配置,可以确保项目中的所有依赖都通过指定的镜像源进行下载。 通过UV 的配置文件设置镜像: UV 还支持通过专门的配置文件(如 uv.toml)来设置镜像源。例如: toml [install] index-url = "https:...
# /// script# requires-python = ">=3.10,<3.11"# dependencies = [# "requests<3",# "rich",# ]# [[tool.uv.index]]# url = "https://pypi.tuna.tsinghua.edu.cn/simple"# [tool.uv]# python-install-mirror = "https://<mirror-url>/indygreg/python-build-standalone/releases/download"#...
https://docs.astral.sh/uv/guides/install-python/ 入门 安装最新的 Python 版本: uv python install 自动 Python 下载 使用现有的 Python 版本 运行脚本 运行没有依赖项的脚本:如果您的脚本没有依赖项,您可以使用 uv run 执行它:例如,名为 example.py 的脚本可以这样运行: uv run example.py Copyuv ...
使用uv,也可以像NodeJS或者Rust项目那样方便的管理依赖。 2. 如何安装 安装uv非常简单,可以使用官方提供的安装脚本,也可以通过pip来安装。 # On macOS and Linux.curl -LsSf https://astral.sh/uv/install.sh | sh# On Windows.powershell -ExecutionPolicy ByPass -c"irm https://astral.sh/uv/install.ps1...