venv-manager 管理 Conda 环境 和 Python 虚拟环境 (venv)

VENV Manager

English

交互式终端选择器,用于管理 Conda 环境Python 虚拟环境 (venv),支持方向键导航、创建、删除和激活 ------ 一条命令搞定。

bash 复制代码
npm i -g venv-manager

cvem  # Conda 环境选择器
pvem  # Python venv 选择器

# 或免安装直接使用:

source <(curl -fsSL https://cdn.jsdelivr.net/gh/theajack/venv-manager/scripts/cvem.sh)
source <(curl -fsSL https://cdn.jsdelivr.net/gh/theajack/venv-manager/scripts/pvem.sh)
命令 说明
cvem Conda 环境选择器 --- 列出 / 创建 / 删除 / 激活 conda 环境
pvem Python venv 选择器 --- 查找 / 创建 / 删除 / 激活虚拟环境

快速使用(CDN --- 免安装)

通过 jsDelivr CDN 直接执行,无需安装任何东西:

bash 复制代码
# Conda 环境选择器
source <(curl -fsSL https://cdn.jsdelivr.net/gh/theajack/venv-manager/scripts/cvem.sh)

# Python venv 选择器
source <(curl -fsSL https://cdn.jsdelivr.net/gh/theajack/venv-manager/scripts/pvem.sh)

通过 npm 安装

bash 复制代码
npm install -g venv-manager

安装完成后,postinstall 脚本会自动将 cvempvem 函数写入 ~/.zshrc~/.bashrc

打开新终端 (或执行 source ~/.zshrc)后即可使用:

bash 复制代码
# Conda 环境选择器
cvem

# Python venv 选择器
pvem

手动配置

如果自动配置未生效,可以手动执行:

bash 复制代码
vem-setup

或者自行添加 shell 函数:

bash 复制代码
# 添加到 ~/.zshrc 或 ~/.bashrc
cvem() { source "$(npm prefix -g)/lib/node_modules/venv-manager/scripts/cvem.sh"; }
pvem() { source "$(npm prefix -g)/lib/node_modules/venv-manager/scripts/pvem.sh"; }

使用方法

cvem --- Conda 环境选择器

复制代码
↑/↓    上下选择
Enter  激活选中的环境
n      新建环境(可选择 Python 版本)
d      删除选中的环境
q      退出

pvem --- Python Venv 选择器

会在当前目录(深度 3)及常用位置(~/.venvs~/venvs~/.virtualenvs)搜索虚拟环境。

复制代码
↑/↓    上下选择
Enter  激活选中的虚拟环境
n      新建虚拟环境(可选择 Python 解释器)
d      删除选中的虚拟环境
q      退出

环境要求

  • bashzsh
  • cvem:需要安装 conda 并配置在 PATH 中
  • pvem:需要 Python 3 及 venv 模块

许可证

MIT

相关推荐
曲幽3 小时前
数据库实战:FastAPI + SQLAlchemy 2.0 + Alembic 从零搭建,踩坑实录
python·fastapi·web·sqlalchemy·db·asyncio·alembic
用户8356290780518 小时前
Python 实现 PowerPoint 形状动画设置
后端·python
ponponon9 小时前
时代的眼泪,nameko 和 eventlet 停止维护后的项目自救,升级和替代之路
python
Flittly9 小时前
【从零手写 ClaudeCode:learn-claude-code 项目实战笔记】(5)Skills (技能加载)
python·agent
敏编程9 小时前
一天一个Python库:pyarrow - 大规模数据处理的利器
python
Flittly11 小时前
【从零手写 ClaudeCode:learn-claude-code 项目实战笔记】(4)Subagents (子智能体)
python·agent
明月_清风18 小时前
Python 装饰器前传:如果不懂“闭包”,你只是在复刻代码
后端·python
明月_清风18 小时前
打破“死亡环联”:深挖 Python 分代回收与垃圾回收(GC)机制
后端·python
ZhengEnCi1 天前
08c. 检索算法与策略-混合检索
后端·python·算法
明月_清风2 天前
Python 内存手术刀:sys.getrefcount 与引用计数的生死时速
后端·python