安装

默认安装路径是$HOME\.local\bin

我自己安装在C:\Env\pyuv

$env:UV_INSTALL_DIR = "C:\Env\pyuv"
irm https://astral.sh/uv/install.ps1 | iex

会自动添加环境变量

Downloading uv 0.7.5 (x86_64-pc-windows-msvc)
Installing to C:\Env\pyuv
  uv.exe
  uvx.exe
everything's installed!

To add C:\Env\pyuv to your PATH, either restart your shell or run:

    set Path=C:\Env\pyuv;%Path%   (cmd)
    $env:Path = "C:\Env\pyuv;$env:Path"   (powershell)

常用命令

https://docs.astral.sh/uv/#python-versions

自定义路径安装python

$env:UV_PYTHON_INSTALL_DIR = "C:\Env\pyuv\pythons"
uv python install 3.12

创建虚拟环境

uv venv --python 3.12
Last modification:May 19, 2025
如果觉得我的文章对你有用,请随意赞赏