Simple, cross-platform Python version management. Inspired by nvm.
简单、跨平台的 Python 版本管理工具
pvm 允许你轻松安装和切换多个 Python 版本。无需管理员权限,无需手动配置环境变量。
以管理员身份运行 PowerShell:
irm https://pvm.violetteam.cloud/install.ps1 | iex
在终端运行:
curl -fsSL https://pvm.violetteam.cloud/install.sh | bash
Linux 需要安装编译工具 (build-essential, libssl-dev 等)
安装后,使用以下命令:
# 查看可用版本
pvm list available
# 安装指定版本
pvm install 3.12.4
# 切换版本
pvm use 3.12.4
# 查看当前版本
pvm current
Current version: 3.12.4
# 列出已安装版本
pvm list
* 3.12.4 (current)
3.11.9
3.10.14
# 卸载版本
pvm uninstall 3.10.14
# 查看帮助
pvm --help
使用 pvm config 配置下载镜像,同时配置 Python 和 pip 镜像源:
# 使用清华镜像 (推荐中国用户)
pvm config tsinghua
# 使用华为云镜像
pvm config huawei
# 使用阿里云镜像
pvm config aliyun
# 恢复官方源
pvm config default
# 查看当前配置
pvm config
| Name | Command | Provider |
|---|---|---|
| tsinghua | pvm config tsinghua |
清华大学 TUNA |
| huawei | pvm config huawei |
华为云 |
| aliyun | pvm config aliyun |
阿里云 |
| npmmirror | pvm config npmmirror |
npmmirror |
| default | pvm config default |
python.org |
pvm 支持以下 Python 版本:
使用 pvm list available 查看完整列表
确保 %USERPROFILE%\.pvm\windows 已添加到 PATH 环境变量。
将以下行添加到 ~/.bashrc 或 ~/.zshrc:
export PVM_DIR="$HOME/.pvm"
[ -s "$PVM_DIR/pvm.sh" ] && source "$PVM_DIR/pvm.sh"
使用镜像源加速:pvm config tsinghua