Simon

Python Venv

开发编程v1.2.0
作者:Simon更新于 2026-05-17共 4 个版本 · 最新版本发布于 2026-03-13python-venv@clawhub_cikichen/python-venv
脚本工具

据 AlphaMoat 统计,截至 2026-09,Python Venv 累计下载 1,728 次、获 0 个星标,在全部 5,078 个 AI 技能中排名第 4,628 位,在「开发编程」分类(577 个)中排名第 547 位。

累计安装
150
累计下载
1,728
星标
-
全站排名
#4,628
全站前 92% · 「开发编程」前 95%
平台累计安装累计下载星标评论
ClawHub ↗371,330--
SkillHub ↗1501,728-—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

该技能根据 lock 文件、项目配置和现有环境推荐 uv、pip、conda、venv 等方案,并主张优先复用现有环境。创建环境、安装依赖或删除既有 .venv 都会改变工作区,应先确认具体范围;远程安装脚本需独立核实来源与内容。生成的建议是环境管理指引,执行前应检查项目依赖和团队规范。 选择管理工具前应核对已安装工具和项目规范。

资料发布于 2026-10-29

可以用来做什么

  • 识别项目已有的 Python 环境和依赖配置
  • 比较复用现有环境或创建新环境的方案
  • 为已确认的依赖安装步骤整理安全检查清单

什么时候用

  • 需要为 Python 项目选择依赖管理工具时
  • 可以先只读检查项目文件,并在创建、安装或删除前取得确认时

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

只检查项目文件并提出复用现有 Python 环境的建议;不要创建环境、安装依赖、删除文件或运行远程安装脚本。

月度数据趋势

累计下载1,728
2081,0251,8412026-03 · 累计下载 3212026-05 · 累计下载 8582026-06 · 累计下载 1,0172026-07 · 累计下载 1,2242026-08 · 累计下载 1,4052026-09 · 累计下载 1,72826-0326-09
星标-
0112026-03 · 星标 -2026-05 · 星标 -2026-06 · 星标 -2026-07 · 星标 -2026-08 · 星标 -2026-09 · 星标 -26-0326-09

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-091,728—-
2026-081,405+14.8%-
2026-071,224+20.4%-
2026-061,017+18.5%-
2026-05858—-
2026-03321—-

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

5.3 KB · ClawHub v1.2.0
---
name: python-venv
description: "Python environment management skill. Automatically detect project type and existing environments, recommend based on popularity. Minimize interruptions, only ask when necessary."
---

# Python Environment Management Skill

## Core Principles

1. **Reuse Existing Environments** - Don't recreate, reuse existing virtual environments
展开全部(共 207 行)
2. **Use Project-Type Decision** - Auto-select based on lock files
3. **Recommend by Popularity** - uv > pip > conda > venv
4. **Minimize Interruption** - Only ask when necessary

---

## Tool Popularity Ranking

| Priority | Tool | Best For |
|----------|------|----------|
| 🥇 | uv | New projects, fast installs |
| 🥈 | pip | Compatibility first |
| 🥉 | conda | Data science, specific versions |
| 4 | venv | Built-in, no extra install |
| 5 | poetry | Existing poetry.lock |
| 6 | pipenv | Existing Pipfile (declining) |

---

## Decision Flow

```
┌─────────────────────────────────────┐
│  Detect project dependency files     │
└─────────────────────────────────────┘
              ↓
    ┌─────────┴─────────┐
    ↓                   ↓
  Clear decision       Unclear
    ↓                   ↓
  Use directly     Detect existing env
                        ↓
                  ┌─────┴─────┐
                  ↓           ↓
              Has env        No env
                  ↓           ↓
              Reuse      Assess complexity
                            ↓
                  ┌─────────┴─────────┐
                  ↓                   ↓
              Simple task       Needs deps
                  ↓                   ↓
            System Python      Recommend uv/conda
```

---

## 1. Clear Decisions (Execute Directly, No Ask)

When these files are detected, use the corresponding tool directly:

| Detected File | Execute |
|--------------|---------|
| `uv.lock` exists | `uv sync` or `uv pip install -r requirements.txt` |
| `poetry.lock` exists | `poetry install` |
| `environment.yml` exists | `conda env create -f environment.yml` |
| `Pipfile.lock` exists | `pipenv install` |

---

## 2. Detect Existing Environments (Reuse First)

```bash
# Priority: uv venv > conda > venv

# 2.1 Detect uv virtual environment
ls -la .venv/ 2>/dev/null && uv pip list 2>/dev/null | head -3

# 2.2 Detect conda environment
conda info --envs 2>/dev/null | grep "*" || echo $CONDA_PREFIX

# 2.3 Detect standard venv
ls -la venv/ .venv/ env/ 2>/dev/null

# 2.4 If exists → Reuse (activate and run commands)
```

**Reuse Example:**
```
Detected existing .venv/ directory
→ Activate: source .venv/bin/activate
→ Run: uv pip install <package>
```

---

## 3. When Unclear (Assess Complexity)

| Scenario | Action |
|----------|--------|
| Stdlib only, no 3rd party | System Python (python3) |
| Simple pip install test | System Python (temp) |
| Has requirements.txt | Recommend uv > pip > venv |
| Has pyproject.toml | Recommend uv > pip |
| Multi-file project, needs isolation | Recommend uv |

---

## 4. When to Ask User (Only These Cases)

✅ **Ask:**
1. Empty project + first dependency install → Ask which tool
2. Both requirements.txt + pyproject.toml → Ask which to use
3. User explicitly wants different tool → e.g., "I want conda"

❌ **Don't Ask:**
- Has uv.lock but user didn't specify
- Has .venv/ directory
- Regular pip install task

---

## 5. Recommended Tool (No Clear Directive)

```
First: uv
  ├── uv venv (create)
  ├── uv pip install (install)
  └── uv sync (sync)

Backup: pip
  ├── python3 -m venv .venv
  └── pip install

Special: conda
  ├── conda create -n envname python=x.x
  └── conda env create
```

---

## Detection Commands

```bash
# Check available tools
which uv
which conda
which pip
which python3

# Check project files
ls -la *.lock pyproject.toml requirements.txt environment.yml Pipfile 2>/dev/null

# Check existing environments
ls -la .venv/ venv/ env/ 2>/dev/null
conda info --envs 2>/dev/null

# Check current environment
echo $VIRTUAL_ENV
echo $CONDA_PREFIX
```

---

## Interaction Examples (Only When Needed)

```
🔍 Detection result:
- Project file: pyproject.toml
- Existing env: None
- Recommended: uv (fastest)

Running: uv pip install <package>
```

```
🔍 Detection result:
- Project file: requirements.txt
- Existing env: None
- Recommended: uv

Available options:
1) uv (recommended) - faster
2) pip - better compatibility
3) venv - uses stdlib
4) conda - if specific version needed

Enter option or press Enter to use recommended:
```

---

## Quick Command Reference

| Action | uv | pip | conda | venv |
|--------|-----|-----|-------|------|
| Create env | `uv venv` | - | `conda create` | `python3 -m venv` |
| Install pkg | `uv pip install` | `pip install` | `conda install` | `pip install` |
| Install deps | `uv sync` | `pip install -r` | `conda env create` | `pip install -r` |
| Activate | (auto) | (auto) | `conda activate` | `source venv/bin/activate` |

---

## Core Principle

**"Do more, ask less"** - Execute directly when you can determine, only ask when truly unclear.

「开发编程」分类下的热门技能

数据月份:2026-09 · 下载/星标/安装数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。